From: Trond Myklebust <trondmy@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Anna Schumaker <anna@kernel.org>
Subject: [PATCH v5 1/3] filemap: Add a helper for filesystems implementing dropbehind
Date: Tue, 9 Sep 2025 21:53:42 -0400 [thread overview]
Message-ID: <ea24b487cd83da3f69f6f358d2d7a167a1dd7687.1757177140.git.trond.myklebust@hammerspace.com> (raw)
In-Reply-To: <cover.1757177140.git.trond.myklebust@hammerspace.com>
From: Trond Myklebust <trond.myklebust@hammerspace.com>
Add a helper to allow filesystems to attempt to free the 'dropbehind'
folio.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Link: https://lore.kernel.org/all/5588a06f6d5a2cf6746828e2d36e7ada668b1739.1745381692.git.trond.myklebust@hammerspace.com/
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
---
include/linux/pagemap.h | 1 +
mm/filemap.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 12a12dae727d..201b7c6f6441 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1221,6 +1221,7 @@ void folio_wait_writeback(struct folio *folio);
int folio_wait_writeback_killable(struct folio *folio);
void end_page_writeback(struct page *page);
void folio_end_writeback(struct folio *folio);
+void folio_end_dropbehind(struct folio *folio);
void folio_wait_stable(struct folio *folio);
void __folio_mark_dirty(struct folio *folio, struct address_space *, int warn);
void folio_account_cleaned(struct folio *folio, struct bdi_writeback *wb);
diff --git a/mm/filemap.c b/mm/filemap.c
index 751838ef05e5..66cec689bec4 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1608,7 +1608,7 @@ static void filemap_end_dropbehind(struct folio *folio)
* completes. Do that now. If we fail, it's likely because of a big folio -
* just reset dropbehind for that case and latter completions should invalidate.
*/
-static void filemap_end_dropbehind_write(struct folio *folio)
+void folio_end_dropbehind(struct folio *folio)
{
if (!folio_test_dropbehind(folio))
return;
@@ -1625,6 +1625,7 @@ static void filemap_end_dropbehind_write(struct folio *folio)
folio_unlock(folio);
}
}
+EXPORT_SYMBOL_GPL(folio_end_dropbehind);
/**
* folio_end_writeback - End writeback against a folio.
@@ -1660,7 +1661,7 @@ void folio_end_writeback(struct folio *folio)
if (__folio_end_writeback(folio))
folio_wake_bit(folio, PG_writeback);
- filemap_end_dropbehind_write(folio);
+ folio_end_dropbehind(folio);
acct_reclaim_writeback(folio);
folio_put(folio);
}
--
2.51.0
next prev parent reply other threads:[~2025-09-10 1:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1755612705.git.trond.myklebust@hammerspace.com>
2025-09-10 1:53 ` [PATCH v5 0/3] Initial NFS client support for RWF_DONTCACHE Trond Myklebust
2025-09-10 1:53 ` Trond Myklebust [this message]
2025-09-10 1:53 ` [PATCH v5 2/3] filemap: Add a version of folio_end_writeback that ignores dropbehind Trond Myklebust
2025-09-10 1:53 ` [PATCH v5 3/3] NFS: Enable use of the RWF_DONTCACHE flag on the NFS client Trond Myklebust
2025-09-10 1:59 ` [PATCH v5 0/3] Initial NFS client support for RWF_DONTCACHE Trond Myklebust
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=ea24b487cd83da3f69f6f358d2d7a167a1dd7687.1757177140.git.trond.myklebust@hammerspace.com \
--to=trondmy@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=anna@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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