From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>,
Christian Brauner <brauner@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6.y 3/5] ceph: Convert ceph_find_incompatible() to take a folio
Date: Fri, 7 Aug 2026 18:10:06 -0400 [thread overview]
Message-ID: <20260807221008.3785418-3-sashal@kernel.org> (raw)
In-Reply-To: <20260807221008.3785418-1-sashal@kernel.org>
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
[ Upstream commit f9707a8b5b9d0a631e0a64eab5c3d2bb6d43758c ]
Both callers already have the folio. Pass it in and use it throughout.
Removes some hidden calls to compound_head() and a reference to
page->mapping.
Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Link: https://lore.kernel.org/r/20250217185119.430193-4-willy@infradead.org
Tested-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: cbf59617cd71 ("ceph: fix writeback_count leak in write_folio_nounlock()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ceph/addr.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 95b3e6b1c11aa..9472e9f25dab0 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1391,23 +1391,23 @@ static int context_is_writeable_or_written(struct inode *inode,
/**
* ceph_find_incompatible - find an incompatible context and return it
- * @page: page being dirtied
+ * @folio: folio being dirtied
*
- * We are only allowed to write into/dirty a page if the page is
+ * We are only allowed to write into/dirty a folio if the folio is
* clean, or already dirty within the same snap context. Returns a
* conflicting context if there is one, NULL if there isn't, or a
* negative error code on other errors.
*
- * Must be called with page lock held.
+ * Must be called with folio lock held.
*/
static struct ceph_snap_context *
-ceph_find_incompatible(struct page *page)
+ceph_find_incompatible(struct folio *folio)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = folio->mapping->host;
struct ceph_inode_info *ci = ceph_inode(inode);
if (ceph_inode_is_shutdown(inode)) {
- dout(" page %p %llx:%llx is shutdown\n", page,
+ dout(" folio %p %llx:%llx is shutdown\n", folio,
ceph_vinop(inode));
return ERR_PTR(-ESTALE);
}
@@ -1415,29 +1415,29 @@ ceph_find_incompatible(struct page *page)
for (;;) {
struct ceph_snap_context *snapc, *oldest;
- wait_on_page_writeback(page);
+ folio_wait_writeback(folio);
- snapc = page_snap_context(page);
+ snapc = page_snap_context(&folio->page);
if (!snapc || snapc == ci->i_head_snapc)
break;
/*
- * this page is already dirty in another (older) snap
+ * this folio is already dirty in another (older) snap
* context! is it writeable now?
*/
oldest = get_oldest_context(inode, NULL, NULL);
if (snapc->seq > oldest->seq) {
/* not writeable -- return it for the caller to deal with */
ceph_put_snap_context(oldest);
- dout(" page %p snapc %p not current or oldest\n", page, snapc);
+ dout(" folio %p snapc %p not current or oldest\n", folio, snapc);
return ceph_get_snap_context(snapc);
}
ceph_put_snap_context(oldest);
- /* yay, writeable, do it now (without dropping page lock) */
- dout(" page %p snapc %p not current, but oldest\n", page, snapc);
- if (clear_page_dirty_for_io(page)) {
- int r = writepage_nounlock(page, NULL);
+ /* yay, writeable, do it now (without dropping folio lock) */
+ dout(" folio %p snapc %p not current, but oldest\n", folio, snapc);
+ if (folio_clear_dirty_for_io(folio)) {
+ int r = writepage_nounlock(&folio->page, NULL);
if (r < 0)
return ERR_PTR(r);
}
@@ -1452,7 +1452,7 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned
struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_snap_context *snapc;
- snapc = ceph_find_incompatible(folio_page(*foliop, 0));
+ snapc = ceph_find_incompatible(*foliop);
if (snapc) {
int r;
@@ -1712,7 +1712,7 @@ static vm_fault_t ceph_page_mkwrite(struct vm_fault *vmf)
break;
}
- snapc = ceph_find_incompatible(&folio->page);
+ snapc = ceph_find_incompatible(folio);
if (!snapc) {
/* success. we'll keep the folio locked. */
folio_mark_dirty(folio);
--
2.53.0
next prev parent reply other threads:[~2026-08-07 22:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 13:46 FAILED: patch "[PATCH] ceph: fix writeback_count leak in write_folio_nounlock()" failed to apply to 6.6-stable tree gregkh
2026-08-07 22:10 ` [PATCH 6.6.y 1/5] ceph: Remove ceph_writepage() Sasha Levin
2026-08-07 22:10 ` [PATCH 6.6.y 2/5] ceph: Use a folio in ceph_page_mkwrite() Sasha Levin
2026-08-07 22:10 ` Sasha Levin [this message]
2026-08-07 22:10 ` [PATCH 6.6.y 4/5] ceph: Convert writepage_nounlock() to write_folio_nounlock() Sasha Levin
2026-08-07 22:10 ` [PATCH 6.6.y 5/5] ceph: fix writeback_count leak in write_folio_nounlock() Sasha Levin
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=20260807221008.3785418-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Slava.Dubeyko@ibm.com \
--cc=brauner@kernel.org \
--cc=stable@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