linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Matthew Wilcox <willy@infradead.org>,
	 Hans Holmberg <hans.holmberg@wdc.com>,
	 linux-xfs@vger.kernel.org,  Carlos Maiolino <cem@kernel.org>,
	 Dave Chinner <david@fromorbit.com>,
	 "Darrick J . Wong" <djwong@kernel.org>,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-api@vger.kernel.org, libc-alpha@sourceware.org
Subject: Re: truncatat? was, Re: [RFC] xfs: fake fallocate success for always CoW inodes
Date: Mon, 10 Nov 2025 11:00:03 +0100	[thread overview]
Message-ID: <lhu5xbiyzq4.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20251110094829.GA24081@lst.de> (Christoph Hellwig's message of "Mon, 10 Nov 2025 10:48:29 +0100")

* 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


      reply	other threads:[~2025-11-10 10:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lhu5xbiyzq4.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).