linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* truncatat? was, Re: [RFC] xfs: fake fallocate success for always CoW inodes
       [not found]             ` <20251110093140.GA22674@lst.de>
@ 2025-11-10  9:48               ` Christoph Hellwig
  2025-11-10 10:00                 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2025-11-10  9:48 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Christoph Hellwig, Florian Weimer, Matthew Wilcox, Hans Holmberg,
	linux-xfs, Carlos Maiolino, Dave Chinner, Darrick J . Wong,
	linux-fsdevel, linux-kernel, linux-api, libc-alpha

On Mon, Nov 10, 2025 at 10:31:40AM +0100, Christoph Hellwig wrote:
> fallocate seems like an odd interface choice for that, but given that
> (f)truncate doesn't have a flags argument that might still be the
> least unexpected version.
> 
> > Maybe add two flags, one for the ftruncate replacement, and one that
> > instructs the file system that the range will be used with mmap soon?
> > I expect this could be useful information to the file system.  We
> > wouldn't use it in posix_fallocate, but applications calling fallocate
> > directly might.
> 
> What do you think "to be used with mmap" flag could be useful for
> in the file system?  For file systems mmap I/O isn't very different
> from other use cases.

The usual way to pass extra flags was the flats at for the *at syscalls.
truncate doesn't have that, and I wonder if there would be uses for
that?  Because if so that feels like the right way to add that feature.
OTOH a quick internet search only pointed to a single question about it,
which was related to other confusion in the use of (f)truncate.

While adding a new system call can be rather cumbersome, the advantage
would be that we could implement the "only increase file size" flag
in common code and it would work on all file systems for kernels that
support the system call.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: truncatat? was, Re: [RFC] xfs: fake fallocate success for always CoW inodes
  2025-11-10  9:48               ` truncatat? was, Re: [RFC] xfs: fake fallocate success for always CoW inodes Christoph Hellwig
@ 2025-11-10 10:00                 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2025-11-10 10:00 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Matthew Wilcox, Hans Holmberg, linux-xfs, Carlos Maiolino,
	Dave Chinner, Darrick J . Wong, linux-fsdevel, linux-kernel,
	linux-api, libc-alpha

* Christoph Hellwig:

> On Mon, Nov 10, 2025 at 10:31:40AM +0100, Christoph Hellwig wrote:
>> fallocate seems like an odd interface choice for that, but given that
>> (f)truncate doesn't have a flags argument that might still be the
>> least unexpected version.
>> 
>> > Maybe add two flags, one for the ftruncate replacement, and one that
>> > instructs the file system that the range will be used with mmap soon?
>> > I expect this could be useful information to the file system.  We
>> > wouldn't use it in posix_fallocate, but applications calling fallocate
>> > directly might.
>> 
>> What do you think "to be used with mmap" flag could be useful for
>> in the file system?  For file systems mmap I/O isn't very different
>> from other use cases.
>
> The usual way to pass extra flags was the flats at for the *at syscalls.
> truncate doesn't have that, and I wonder if there would be uses for
> that?  Because if so that feels like the right way to add that feature.
> OTOH a quick internet search only pointed to a single question about it,
> which was related to other confusion in the use of (f)truncate.
>
> While adding a new system call can be rather cumbersome, the advantage
> would be that we could implement the "only increase file size" flag
> in common code and it would work on all file systems for kernels that
> support the system call.

There are some references to ftruncateat:

  <https://codesearch.debian.net/search?q=ftruncateat&literal=1>

I don't have a particularly strong opinion on the choice of interface.
I can't find anything in the Austin Group tracker that suggests that
they are considering standardizing ftruncateat without a flags argument.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-10 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20251106133530.12927-1-hans.holmberg@wdc.com>
     [not found] ` <lhuikfngtlv.fsf@oldenburg.str.redhat.com>
     [not found]   ` <20251106135212.GA10477@lst.de>
     [not found]     ` <aQyz1j7nqXPKTYPT@casper.infradead.org>
     [not found]       ` <lhu4ir7gm1r.fsf@oldenburg.str.redhat.com>
     [not found]         ` <20251106170501.GA25601@lst.de>
     [not found]           ` <878qgg4sh1.fsf@mid.deneb.enyo.de>
     [not found]             ` <20251110093140.GA22674@lst.de>
2025-11-10  9:48               ` truncatat? was, Re: [RFC] xfs: fake fallocate success for always CoW inodes Christoph Hellwig
2025-11-10 10:00                 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).