On Sun, Nov 17, 2013 at 02:02:15AM +0100, Emmanuel Dreyfus wrote: > NetBSD-current seems to lack posix_fallocate(2) > http://pubs.opengroup.org/onlinepubs/009695299/functions/posix_fallocate > .html > > Is someone already working on it, or has thoughs about how it should be > implemented?
I have most of the plumbing (see "DIOCGDISCARDINFO and DIOCDISCARD") but not an implementation for ffs or any other fs. I think the chief question at this level is whether to support the "keep the length" flag for fallocate, fdiscard, both, or neither. The linux fallocate uses this to allow allocating blocks past EOF, which strikes me as nuts; however, for discarding blocks it seems that there's no inherent problem with having a hole at EOF and that shrinking the file just because you dropped the block that contains EOF is kind of silly. (And if the block containing EOF was the only block, does it ratchet the size all the way back to zero? Ugh.) I vaguely recall that some time back somebody had a preliminary implementation of either fallocate or fdiscard or both for ffs, which was not really good enough to commit. But I forget who and in what context, so of course now I can't find it. -- David A. Holland dholl...@netbsd.org