On Tue, 2010-10-19 at 21:55 -0500, Stan Hoeppner wrote:
Any chance the mbox/mdbox writer code could be modified to do physical preallocation on files to help avoid file(system) fragmentation?
I've been thinking about that before.
"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.
http://hg.dovecot.org/dovecot-2.0/rev/22c81f884032 http://hg.dovecot.org/dovecot-2.0/rev/b884441a713f