From: Tal Zussman <tz2294@columbia.edu>
To: Ilya Dryomov <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>,
Viacheslav Dubeyko <slava@dubeyko.com>,
Christian Brauner <brauner@kernel.org>,
Jeff Layton <jlayton@kernel.org>,
David Howells <dhowells@redhat.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Zi Yan <ziy@nvidia.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Tal Zussman <tz2294@columbia.edu>
Subject: [PATCH v5 06/10] ceph: convert ceph_submit_write() to folios
Date: Wed, 02 Sep 2026 12:11:30 -0400 [thread overview]
Message-ID: <20260902-remove-wait-on-page-writeback-v5-6-0b512e77e75b@columbia.edu> (raw)
In-Reply-To: <20260902-remove-wait-on-page-writeback-v5-0-0b512e77e75b@columbia.edu>
Convert the request assembly loop and error path in ceph_submit_write()
to folios. This drops ceph's uses of the set_page_writeback(),
redirty_page_for_writepage(), and unlock_page() compatibility wrappers
in the writeback submission path.
Add ceph_folio_start_fscache(), a folio counterpart of
ceph_set_page_fscache(). The remaining caller of the latter in
write_folio_nounlock() will be converted separately.
In total, this removes eight calls to compound_head() hidden in the
page-based APIs and one explicit page_folio() call in
ceph_undo_wrbuffer_claim()'s caller, while adding four explicit
page_folio() calls.
Note that get_writepages_data_length() must still be passed the
possibly-bounce folio, not the unwrapped pagecache folio, as it checks
fscrypt_is_bounce_folio() to round encrypted lengths up to the fscrypt
block size.
No functional change.
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
fs/ceph/addr.c | 43 ++++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index a72efe96e1f8..b0deff481d95 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -558,6 +558,11 @@ const struct netfs_request_ops ceph_netfs_ops = {
};
#ifdef CONFIG_CEPH_FSCACHE
+static void ceph_folio_start_fscache(struct folio *folio)
+{
+ folio_start_private_2(folio); /* [DEPRECATED] */
+}
+
static void ceph_set_page_fscache(struct page *page)
{
folio_start_private_2(page_folio(page)); /* [DEPRECATED] */
@@ -585,6 +590,10 @@ static void ceph_fscache_write_to_cache(struct inode *inode, u64 off, u64 len, b
ceph_fscache_write_terminated, inode, true, caching);
}
#else
+static inline void ceph_folio_start_fscache(struct folio *folio)
+{
+}
+
static inline void ceph_set_page_fscache(struct page *page)
{
}
@@ -1467,14 +1476,14 @@ int ceph_submit_write(struct address_space *mapping,
struct ceph_client *cl = fsc->client;
struct ceph_vino vino = ceph_vino(inode);
struct ceph_osd_request *req = NULL;
- struct page *page = NULL;
+ struct folio *folio = NULL;
bool caching = ceph_is_cache_enabled(inode);
u64 offset;
u64 len;
unsigned i;
new_request:
- offset = ceph_fscrypt_page_offset(ceph_wbc->pages[0]);
+ offset = ceph_fscrypt_folio_offset(page_folio(ceph_wbc->pages[0]));
len = ceph_wbc->wsize;
req = ceph_osdc_new_request(&fsc->client->osdc,
@@ -1498,14 +1507,14 @@ int ceph_submit_write(struct address_space *mapping,
BUG_ON(IS_ERR(req));
}
- page = ceph_wbc->pages[ceph_wbc->locked_pages - 1];
- BUG_ON(len < ceph_fscrypt_page_offset(page) + thp_size(page) - offset);
+ folio = page_folio(ceph_wbc->pages[ceph_wbc->locked_pages - 1]);
+ BUG_ON(len < ceph_fscrypt_folio_offset(folio) + folio_size(folio) - offset);
if (!ceph_inc_osd_stopping_blocker(fsc->mdsc)) {
for (i = 0; i < ceph_wbc->locked_pages; i++) {
- page = ceph_wbc->pages[i];
- if (fscrypt_is_bounce_page(page)) {
- page = fscrypt_pagecache_page(page);
+ folio = page_folio(ceph_wbc->pages[i]);
+ if (fscrypt_is_bounce_folio(folio)) {
+ folio = fscrypt_pagecache_folio(folio);
fscrypt_free_bounce_page(ceph_wbc->pages[i]);
}
@@ -1513,10 +1522,10 @@ int ceph_submit_write(struct address_space *mapping,
CONGESTION_OFF_THRESH(fsc->mount_options->congestion_kb))
fsc->write_congested = false;
- ceph_undo_wrbuffer_claim(inode, page_folio(page));
- redirty_page_for_writepage(wbc, page);
- unlock_page(page);
- put_page(page);
+ ceph_undo_wrbuffer_claim(inode, folio);
+ folio_redirty_for_writepage(wbc, folio);
+ folio_unlock(folio);
+ folio_put(folio);
}
if (ceph_wbc->from_pool) {
@@ -1542,8 +1551,8 @@ int ceph_submit_write(struct address_space *mapping,
for (i = 0; i < ceph_wbc->locked_pages; i++) {
u64 cur_offset;
- page = ceph_fscrypt_pagecache_page(ceph_wbc->pages[i]);
- cur_offset = page_offset(page);
+ folio = ceph_fscrypt_pagecache_folio(page_folio(ceph_wbc->pages[i]));
+ cur_offset = folio_pos(folio);
/*
* Discontinuity in page range? Ceph can handle that by just passing
@@ -1576,12 +1585,12 @@ int ceph_submit_write(struct address_space *mapping,
ceph_wbc->op_idx++;
}
- set_page_writeback(page);
+ folio_start_writeback(folio);
if (caching)
- ceph_set_page_fscache(page);
+ ceph_folio_start_fscache(folio);
- len += thp_size(page);
+ len += folio_size(folio);
}
ceph_fscache_write_to_cache(inode, offset, len, caching);
@@ -1592,7 +1601,7 @@ int ceph_submit_write(struct address_space *mapping,
/* writepages_finish() clears writeback pages
* according to the data length, so make sure
* data length covers all locked pages */
- u64 min_len = len + 1 - thp_size(page);
+ u64 min_len = len + 1 - folio_size(folio);
len = get_writepages_data_length(inode,
page_folio(ceph_wbc->pages[i - 1]),
offset);
--
2.39.5
next prev parent reply other threads:[~2026-09-02 16:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 16:11 [PATCH v5 00/10] ceph: convert writeback path " Tal Zussman
2026-09-02 16:11 ` [PATCH v5 01/10] ceph: fix error handling when the OSD client is stopping in ceph_submit_write() Tal Zussman
2026-09-02 16:11 ` [PATCH v5 02/10] ceph: wait for pending fscache write in write_folio_nounlock() Tal Zussman
2026-09-02 16:11 ` [PATCH v5 03/10] ceph: add ceph_folio_snap_context() Tal Zussman
2026-09-02 16:11 ` [PATCH v5 04/10] ceph: convert ceph_wait_until_current_writes_complete() to folios Tal Zussman
2026-09-02 16:11 ` [PATCH v5 05/10] ceph: convert get_writepages_data_length() " Tal Zussman
2026-09-02 16:11 ` Tal Zussman [this message]
2026-09-02 16:11 ` [PATCH v5 07/10] ceph: remove page remnants from write_folio_nounlock() Tal Zussman
2026-09-02 16:11 ` [PATCH v5 08/10] ceph: convert page cleanup loop in writepages_finish() to folios Tal Zussman
2026-09-02 16:11 ` [PATCH v5 09/10] ceph: remove ceph_fscrypt_pagecache_page() and ceph_fscrypt_page_offset() Tal Zussman
2026-09-02 16:11 ` [PATCH v5 10/10] ceph: rename ceph_check_page_before_write() to ceph_check_folio_before_write() Tal Zussman
2026-10-08 16:00 ` [PATCH v5 00/10] ceph: convert writeback path to folios David Howells
2026-10-10 0:16 ` Tal Zussman
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=20260902-remove-wait-on-page-writeback-v5-6-0b512e77e75b@columbia.edu \
--to=tz2294@columbia.edu \
--cc=amarkuze@redhat.com \
--cc=brauner@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=dhowells@redhat.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=slava@dubeyko.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/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
all inboxes | Powered by JetHome®