svn commit: r325320 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

John Baldwin jhb at freebsd.org
Mon Nov 6 23:40:14 UTC 2017


On Thursday, November 02, 2017 10:38:49 AM Ngie Cooper wrote:
> 
> > On Nov 2, 2017, at 06:49, Andriy Gapon <avg at FreeBSD.org> wrote:
> > 
> > Author: avg
> > Date: Thu Nov  2 13:49:08 2017
> > New Revision: 325320
> > URL: https://svnweb.freebsd.org/changeset/base/325320
> > 
> > Log:
> >  Disable posix_fallocate(2) for ZFS
> > 
> >  The generic (naive) implementation of posix_fallocate cannot provide the
> >  standard mandated guarantee that overwrites would never fail due to the lack
> >  of free space.  The fundamental reason is the copy-on-write architecture
> >  of ZFS.  Other features like compression and deduplication can also
> >  increase the size difference between the (pre-)allocated dummy content
> >  and the future content.
> > 
> >  So, until ZFS can properly implement the feature it's better to report
> >  that it is unsupported rather than providing an ersatz implementation.
> >  Please note that EINVAL is used to report that the underlying file system
> >  does not support the operation (POSIX.1-2008).
> > 
> >  illumos and ZoL seem to do the same.
> > 
> >  MFC after:    3 weeks
> >  Sponsored by:    Panzura
> 
> It’d be nice if it worked though and was reported via the file system.  Posix suggests it should be, as of 2013: http://austingroupbugs.net/view.php?id=687 .
> 
> Need to go poking around and see what’s in freebsd later on tonight. Bug filed: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223383 .

The austingroup link is just about adding a new pathconf() variable.
posix_fallocate() would seem to be fundamentally incompatible with COW
filesystems and can never work reliably for those.  Even if you reserved N
free blocks somehow until the first write, that doesn't allow multiple
writes to the same file blocks while avoiding block allocation.  fallocate
only makes sense for overwriting filesystems like UFS.

-- 
John Baldwin


More information about the svn-src-head mailing list