Re: [RFC] xfs: fake fallocate success for always CoW inodes

From: hch

Date: Tue Nov 11 2025 - 08:40:59 EST


On Tue, Nov 11, 2025 at 10:50:13AM +0100, Florian Weimer wrote:
> > On Tue, Nov 11, 2025 at 08:31:30AM +0000, Hans Holmberg wrote:
> >> In stead of returning success in fallocate(2), could we in stead return
> >> an distinct error code that would tell the caller that:
> >>
> >> The optimized allocation not supported, AND there is no use trying to
> >> preallocate data using writes?
> >>
> >> EUSELESS would be nice to have, but that is not available.
> >>
> >> Then posix_fallocate could fail with -EINVAL (which looks legit according
> >> to the man page "the underlying filesystem does not support the operation")
> >> or skip the writes and return success (whatever is preferable)
> >
> > The problem is that both the existing direct callers of fallocate(2)
> > including all currently released glibc versions do not expect that
> > return value.
>
> That could be covered by putting a flag into the mode argument of
> allocate that triggers the new behavior.

Which basically makes it a new mode, just encoded as a flag for all
purposes ;-)