From: Tal Zussman <tz2294@columbia.edu>
To: Ilya Dryomov <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>,
Viacheslav Dubeyko <slava@dubeyko.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Zi Yan <ziy@nvidia.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 05/10] ceph: convert ceph_submit_write() to folios
Date: Thu, 6 Aug 2026 21:58:11 +0300 [thread overview]
Message-ID: <f835fc25-7841-47ff-bb2a-7f91b534dec1@columbia.edu> (raw)
In-Reply-To: <20260804-remove-wait-on-page-writeback-v2-5-81f0ab065284@columbia.edu>
On 8/4/26 2:52 PM, Tal Zussman wrote:
> Convert the request assembly loop and error paths 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 nine calls to compound_head() hidden in the
> page-based APIs, while adding four explicit ones via page_folio().
>
> 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 | 44 ++++++++++++++++++++++++++------------------
> 1 file changed, 26 insertions(+), 18 deletions(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index c81e9da42df9..a96986c503bf 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -553,6 +553,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] */
> @@ -575,6 +580,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)
> {
> }
> @@ -1436,14 +1445,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,
> @@ -1467,29 +1476,28 @@ 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 < folio_batch_count(&ceph_wbc->fbatch); i++) {
> - struct folio *folio = ceph_wbc->fbatch.folios[i];
> + folio = ceph_wbc->fbatch.folios[i];
>
> if (!folio)
> continue;
This, ...
>
> - page = &folio->page;
> - redirty_page_for_writepage(wbc, page);
> - unlock_page(page);
> + folio_redirty_for_writepage(wbc, folio);
> + folio_unlock(folio);
> }
>
> for (i = 0; i < ceph_wbc->locked_pages; i++) {
> - page = ceph_fscrypt_pagecache_page(ceph_wbc->pages[i]);
> + folio = ceph_fscrypt_pagecache_folio(page_folio(ceph_wbc->pages[i]));
>
> - if (!page)
> + if (!folio)
> continue;
>
... and this check are unnecessary. ceph_fscrypt_pagecache_page() can't
take or return NULL, and ceph_shift_unused_folios_left() compacts NULLs
out of ceph_wbc->fbatch. Will remove both in v3.
> - redirty_page_for_writepage(wbc, page);
> - unlock_page(page);
> + folio_redirty_for_writepage(wbc, folio);
> + folio_unlock(folio);
> }
>
> ceph_osdc_put_request(req);
> @@ -1506,8 +1514,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
> @@ -1540,12 +1548,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);
> @@ -1556,7 +1564,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);
>
next prev parent reply other threads:[~2026-08-06 18:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 18:52 [PATCH v2 00/10] ceph: convert writeback path " Tal Zussman
2026-08-04 18:52 ` [PATCH v2 01/10] ceph: add ceph_folio_snap_context() Tal Zussman
2026-08-04 19:59 ` Zi Yan
2026-08-04 23:42 ` Matthew Wilcox
2026-08-04 18:52 ` [PATCH v2 02/10] ceph: convert ceph_wait_until_current_writes_complete() to folios Tal Zussman
2026-08-04 18:52 ` [PATCH v2 03/10] mm: remove wait_on_page_writeback() Tal Zussman
2026-08-04 18:52 ` [PATCH v2 04/10] ceph: convert get_writepages_data_length() to folios Tal Zussman
2026-08-04 18:52 ` [PATCH v2 05/10] ceph: convert ceph_submit_write() " Tal Zussman
2026-08-06 18:58 ` Tal Zussman [this message]
2026-08-06 19:51 ` Tal Zussman
2026-08-04 18:52 ` [PATCH v2 06/10] mm: remove thp_size() and thp_order() Tal Zussman
2026-08-06 11:55 ` David Hildenbrand (Arm)
2026-08-04 18:52 ` [PATCH v2 07/10] ceph: remove page remnants from write_folio_nounlock() Tal Zussman
2026-08-04 18:52 ` [PATCH v2 08/10] ceph: convert page cleanup loop in writepages_finish() to folios Tal Zussman
2026-08-04 23:33 ` Tal Zussman
2026-08-04 23:53 ` Matthew Wilcox
2026-08-04 18:52 ` [PATCH v2 09/10] ceph: remove ceph_fscrypt_pagecache_page() and ceph_fscrypt_page_offset() Tal Zussman
2026-08-04 18:52 ` [PATCH v2 10/10] ceph: rename ceph_check_page_before_write() to ceph_check_folio_before_write() 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=f835fc25-7841-47ff-bb2a-7f91b534dec1@columbia.edu \
--to=tz2294@columbia.edu \
--cc=akpm@linux-foundation.org \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=david@kernel.org \
--cc=idryomov@gmail.com \
--cc=jack@suse.cz \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=slava@dubeyko.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--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®