posix_fallocate(2)

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Apr 15 14:20:03 UTC 2011


On Fri, Apr 15, 2011 at 01:54:09PM +0300, Gleb Kurtsou wrote:
[...]
> As far as I understand ZFS caches large chunk of changes and than writes
> all of them at once. I doubt blocks can be preallocated. You preallocate
> block, it's marked as used in file systems meta data, changes to meta
> data are written to disk -- it results in inconsistency because
> preallocated block is marked as "used" in meta data and thus can't
> be overwritten. I might be absolutely wrong, ZFS experts are
> better answer this. Grepping reveals no fallocate support in ZFS.
[...]
> Why wouldn't you just call VOP_SETATTR(newsize) in dumb implementation.
> File systems expect files such behavior, cp is using mmap for a while
> already.

The idea behind posix_fallocate(2) is to guarantee that there will be
enough space for future writes. It does make sense for ZFS too, because
it will at least reserve space. VOP_SETATTR(newsize) won't reserve any
space, it will just create a hole.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20110415/7189c13c/attachment.pgp


More information about the freebsd-arch mailing list