As with many peer-to-peer sorts of software, file pre-allocation is important in dmedia as it ensures the needed space for a file is reserved at the start of a file transfer.
However, pre-allocation is also extremely important in dmedia for performance reasons, especially as video editing is perhaps the most important use-case for dmedia. Particularly when a FileStore resides on an ext4 filesystem (which is what we recommend), using fallocate allows us to get instant pre-allocation without writing zeros, to get the most contiguous allocation possible, and to take advantage of ext4 extents as much as possible.
When importing or transferring, the file-size is known in advance, so FileStore uses fallocate (when available). The only time FileStore doesn't use fallocate is when writing a file into the FileStore as it is rendered (in which case the final file-size isn't known in advance).
Currently FileStore calls `/usr/bin/fallocate`, which gets the job done but is kinda hacky and dirty. Instead, we should use the posix_fallocate() system call.
I'd personally really like to see os.fallocate(fd, offset, length) added to the standard library in Python 3.3, but in the meantime, we can carry a small extension module in filestore to do the same.
I would suggest keeping it open. This might be a hacky solution but works perfectly.
Just think about the solutions.
1) Getting fallocate implemented upstream - Takes time
2) Create your own goddamn wrapper library - One more goddamn library to maintain
I would prefer 1. Solution no 2 would make maintenance tougher.
It would be better to remove this bug from that milestone. Maintainer - take your call.