diff mbox series

[v3,6/9] ceph: Convert ceph_check_page_before_write() to use a folio

Message ID 20250217185119.430193-7-willy@infradead.org (mailing list archive)
State New
Headers show
Series Remove accesses to page->index from ceph | expand

Commit Message

Matthew Wilcox Feb. 17, 2025, 6:51 p.m. UTC
Remove the conversion back to a struct page and just use the folio
passed in.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ceph/addr.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 871adfa82c1f..90d154bc4808 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1142,18 +1142,17 @@  int ceph_check_page_before_write(struct address_space *mapping,
 	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_client *cl = fsc->client;
 	struct ceph_snap_context *pgsnapc;
-	struct page *page = &folio->page;
 
-	/* only dirty pages, or our accounting breaks */
-	if (unlikely(!PageDirty(page)) || unlikely(page->mapping != mapping)) {
-		doutc(cl, "!dirty or !mapping %p\n", page);
+	/* only dirty folios, or our accounting breaks */
+	if (unlikely(!folio_test_dirty(folio) || folio->mapping != mapping)) {
+		doutc(cl, "!dirty or !mapping %p\n", folio);
 		return -ENODATA;
 	}
 
 	/* only if matching snap context */
-	pgsnapc = page_snap_context(page);
+	pgsnapc = page_snap_context(&folio->page);
 	if (pgsnapc != ceph_wbc->snapc) {
-		doutc(cl, "page snapc %p %lld != oldest %p %lld\n",
+		doutc(cl, "folio snapc %p %lld != oldest %p %lld\n",
 		      pgsnapc, pgsnapc->seq,
 		      ceph_wbc->snapc, ceph_wbc->snapc->seq);
 
@@ -1164,7 +1163,7 @@  int ceph_check_page_before_write(struct address_space *mapping,
 		return -ENODATA;
 	}
 
-	if (page_offset(page) >= ceph_wbc->i_size) {
+	if (folio_pos(folio) >= ceph_wbc->i_size) {
 		doutc(cl, "folio at %lu beyond eof %llu\n",
 		      folio->index, ceph_wbc->i_size);
 
@@ -1177,8 +1176,8 @@  int ceph_check_page_before_write(struct address_space *mapping,
 	}
 
 	if (ceph_wbc->strip_unit_end &&
-	    (page->index > ceph_wbc->strip_unit_end)) {
-		doutc(cl, "end of strip unit %p\n", page);
+	    (folio->index > ceph_wbc->strip_unit_end)) {
+		doutc(cl, "end of strip unit %p\n", folio);
 		return -E2BIG;
 	}