On 20.10.2010, at 17.53, Timo Sirainen wrote:
"What you want is _physical_ preallocation, not speculative preallocation. i.e. look up XFS_IOC_RESVSP or FIEMAP so your application does _permanent_ preallocate past EOF.
Oh, interesting. I didn't know that was possible. And even better: Linux has fallocate() that can do it for other filesystems than just XFS. Or looks like it's only XFS and ext4 (ext3 doesn't support it). I don't know if other OSes support this. Maybe in future I could make mdbox support writing to files whose size has been preallocated by actually writing NUL bytes, but that requires some extra code.
Looks like OS X has fcntl(F_PREALLOCATE), although it doesn't seem to produce any visible results, other than giving ENOSPC error if I give too large of a size (100 MB or so). Disk usage doesn't shrink though, so maybe it's more of a hint?..
Mike, do you think this code is actually working/useful with OSX? :)