[PATCH 1/4] ceph: add ceph_folio_snap_context()
Tal Zussman <[email protected]> Sun, 02 Aug 2026 12:50:02 -0400
| Newsgroups | org.kernel.vger.ceph-devel,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <20260802-remove-wait-on-page-writeback-v1-1-6c35d6b3ad36@columbia.edu> |
Add a folio-based counterpart to page_snap_context() that reads the snap context from folio->private directly. Convert the three writeback paths that passed &folio->page to page_snap_context() to ceph_folio_snap_context(), removing three open-coded folio-to-page conversions. No functional change. Signed-off-by: Tal Zussman <[email protected]> --- fs/ceph/addr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index ecf33b66610c..a8ed2a14da44 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -75,6 +75,13 @@ static inline struct ceph_snap_context *page_snap_context(struct page *page) return NULL; } +static inline struct ceph_snap_context *ceph_folio_snap_context(struct folio *folio) +{ + if (folio_test_private(folio)) + return (void *)folio->private; + return NULL; +} + /* * Dirty a page. Optimistically adjust accounting, on the assumption * that we won't race with invalidate. If we do, readjust. @@ -745,7 +752,7 @@ static int write_folio_nounlock(struct folio *folio, return -EIO; /* verify this is a writeable snap context */ - snapc = page_snap_context(&folio->page); + snapc = ceph_folio_snap_context(folio); if (!snapc) { doutc(cl, "%llx.%llx folio %p not dirty?\n", ceph_vinop(inode), folio); @@ -1171,7 +1178,7 @@ int ceph_check_page_before_write(struct address_space *mapping, } /* only if matching snap context */ - pgsnapc = page_snap_context(&folio->page); + pgsnapc = ceph_folio_snap_context(folio); if (pgsnapc != ceph_wbc->snapc) { doutc(cl, "folio snapc %p %lld != oldest %p %lld\n", pgsnapc, pgsnapc->seq, @@ -1824,7 +1831,7 @@ ceph_find_incompatible(struct folio *folio) folio_wait_writeback(folio); - snapc = page_snap_context(&folio->page); + snapc = ceph_folio_snap_context(folio); if (!snapc || snapc == ci->i_head_snapc) break; -- 2.39.5