From: Jens Axboe <axboe@kernel.dk>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-man@vger.kernel.org,
"Darrick J . Wong" <djwong@kernel.org>
Subject: Re: RWF_DONTCACHE documentation
Date: Mon, 2 Jun 2025 14:54:01 -0600 [thread overview]
Message-ID: <a8a96487-99d9-442d-bf05-2df856458b39@kernel.dk> (raw)
In-Reply-To: <cb062be5-04e4-4131-94cc-6a8d90a809ac@kernel.dk>
On 6/2/25 9:49 AM, Jens Axboe wrote:
> On 6/2/25 9:00 AM, Christoph Hellwig wrote:
>> Hi Jens,
>>
>> I just tried to reference RWF_DONTCACHE semantics in a standards
>> discussion, but it doesn't seem to be documented in the man pages
>> or in fact anywhere else I could easily find. Could you please write
>> up the semantics for the preadv2/pwritev2 man page?
>
> Sure, I can write up something for the man page.
Adding Darrick as well, as a) he helped review the patches, and b) his
phrasing is usually much better than mine.
Anyway, here's my first attempt:
diff --git a/man/man2/readv.2 b/man/man2/readv.2
index c3b0a7091619..2e23e2f15cf4 100644
--- a/man/man2/readv.2
+++ b/man/man2/readv.2
@@ -301,6 +301,28 @@ or their equivalent flags and system calls are used
.B RWF_SYNC
is specified for
.BR pwritev2 ()).
+.TP
+.BR RWF_DONTCACHE " (since Linux 6.14)"
+Reads or writes to a regular file will prune instantiated page cache content
+when the operation completes. This is different than normal buffered I/O,
+where the data usually remains in cache until such time that it gets reclaimed
+due to memory pressure. If ranges of the read or written I/O was already in
+cache before this read or write, then those range will not be pruned at I/O
+completion time. Additionally, any range dirtied by a write operation with
+.B RWF_DONTCACHE
+set will get kicked off for writeback. This is similar to calling
+.BR sync_file_range (2)
+with
+.IR SYNC_FILE_RANGE_WRITE
+to start writeback on the given range.
+.B RWF_DONTCACHE
+is a hint, or best effort, where no hard guarantees are given on the state of
+the page cache once the operation completes. Note: file systems must support
+this feature as well. If used on a file system or block device that doesn't
+support it will return \-1 and
+.I errno
+will be set to
+.B EOPNOTSUPP .
.SH RETURN VALUE
On success,
.BR readv (),
@@ -368,6 +390,12 @@ value from
.I statx.
.TP
.B EOPNOTSUPP
+.B RWF_DONTCACHE
+was set in
+.IR flags
+and the file doesn't support it.
+.TP
+.B EOPNOTSUPP
An unknown flag is specified in
.IR flags .
.SH VERSIONS
--
Jens Axboe
next prev parent reply other threads:[~2025-06-02 20:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 15:00 RWF_DONTCACHE documentation Christoph Hellwig
2025-06-02 15:49 ` Jens Axboe
2025-06-02 20:54 ` Jens Axboe [this message]
2025-06-11 8:41 ` Alejandro Colomar
2025-08-11 17:25 ` Jens Axboe
2025-08-18 4:01 ` Alejandro Colomar
2025-08-18 20:42 ` Jens Axboe
2025-09-01 14:22 ` [PATCH v2] man/man2/readv.2: Document RWF_DONTCACHE Alejandro Colomar
2025-09-01 14:34 ` Alejandro Colomar
2025-09-01 14:36 ` Jens Axboe
2025-09-02 5:21 ` Christoph Hellwig
2025-06-03 6:20 ` RWF_DONTCACHE documentation Johannes Thumshirn
2025-06-03 13:10 ` Jens Axboe
2025-06-03 18:19 ` Johannes Thumshirn
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=a8a96487-99d9-442d-bf05-2df856458b39@kernel.dk \
--to=axboe@kernel.dk \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-man@vger.kernel.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).