From: trondmy@kernel.org
To: linux-nfs@vger.kernel.org
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: [RFC PATCH 2/3] filemap: Mark folios as dropbehind in generic_perform_write()
Date: Wed, 23 Apr 2025 00:25:31 -0400 [thread overview]
Message-ID: <b7ea4a2b3a8f38e2777ac0363a364141cf3db2e8.1745381692.git.trond.myklebust@hammerspace.com> (raw)
In-Reply-To: <cover.1745381692.git.trond.myklebust@hammerspace.com>
From: Trond Myklebust <trond.myklebust@hammerspace.com>
The iocb flags are not passed down to the write_begin() callback that is
allocating the folio, so we need to set the dropbehind folio flag from
inside the generic_perform_write() function itself.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
mm/filemap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/filemap.c b/mm/filemap.c
index 12f694880bb8..4c383f29e828 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -4136,6 +4136,11 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i)
copied = copy_folio_from_iter_atomic(folio, offset, bytes, i);
flush_dcache_folio(folio);
+ if (iocb->ki_flags & IOCB_DONTCACHE)
+ folio_set_dropbehind(folio);
+ else if (folio_test_dropbehind(folio))
+ folio_clear_dropbehind(folio);
+
status = a_ops->write_end(file, mapping, pos, bytes, copied,
folio, fsdata);
if (unlikely(status != copied)) {
--
2.49.0
next prev parent reply other threads:[~2025-04-23 4:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 4:25 [RFC PATCH 0/3] Initial NFS client support for RWF_DONTCACHE trondmy
2025-04-23 4:25 ` [RFC PATCH 1/3] filemap: Add a helper for filesystems implementing dropbehind trondmy
2025-04-24 21:30 ` Mike Snitzer
2025-04-23 4:25 ` trondmy [this message]
2025-04-24 21:30 ` [RFC PATCH 2/3] filemap: Mark folios as dropbehind in generic_perform_write() Mike Snitzer
2025-04-23 4:25 ` [RFC PATCH 3/3] NFS: Enable the RWF_DONTCACHE flag for the NFS client trondmy
2025-04-24 21:31 ` Mike Snitzer
2025-04-23 14:38 ` [RFC PATCH 0/3] Initial NFS client support for RWF_DONTCACHE Chuck Lever
2025-04-23 15:22 ` Matthew Wilcox
2025-04-23 15:30 ` Chuck Lever
2025-04-24 16:51 ` Mike Snitzer
2025-04-24 16:59 ` Chuck Lever
2025-04-24 21:29 ` [PATCH 4/3] NFS: add RWF_DONTCACHE support to LOCALIO Mike Snitzer
2025-07-14 6:22 ` [RFC PATCH 0/3] Initial NFS client support for RWF_DONTCACHE Christoph Hellwig
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=b7ea4a2b3a8f38e2777ac0363a364141cf3db2e8.1745381692.git.trond.myklebust@hammerspace.com \
--to=trondmy@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@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