diff mbox series

[08/15] ceph: Convert writepages_finish() to use a folio

Message ID 20230825201225.348148-9-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Many folio conversions for ceph | expand

Commit Message

Matthew Wilcox Aug. 25, 2023, 8:12 p.m. UTC
Remove several implicit calls to compound_head().  Remove the
BUG_ON(!page) as it won't help debug any crashes (the WARN_ON will crash
in a distinctive way).

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

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 02caf10d43ed..765b37db2729 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -806,7 +806,6 @@  static void writepages_finish(struct ceph_osd_request *req)
 	struct inode *inode = req->r_inode;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_osd_data *osd_data;
-	struct page *page;
 	int num_pages, total_pages = 0;
 	int i, j;
 	int rc = req->r_result;
@@ -850,29 +849,28 @@  static void writepages_finish(struct ceph_osd_request *req)
 					   (u64)osd_data->length);
 		total_pages += num_pages;
 		for (j = 0; j < num_pages; j++) {
-			page = osd_data->pages[j];
-			if (fscrypt_is_bounce_page(page)) {
-				page = fscrypt_pagecache_page(page);
+			struct folio *folio = page_folio(osd_data->pages[j]);
+			if (fscrypt_is_bounce_folio(folio)) {
+				folio = fscrypt_pagecache_folio(folio);
 				fscrypt_free_bounce_page(osd_data->pages[j]);
-				osd_data->pages[j] = page;
+				osd_data->pages[j] = &folio->page;
 			}
-			BUG_ON(!page);
-			WARN_ON(!PageUptodate(page));
+			WARN_ON(!folio_test_uptodate(folio));
 
 			if (atomic_long_dec_return(&fsc->writeback_count) <
 			     CONGESTION_OFF_THRESH(
 					fsc->mount_options->congestion_kb))
 				fsc->write_congested = false;
 
-			ceph_put_snap_context(detach_page_private(page));
-			end_page_writeback(page);
-			dout("unlocking %p\n", page);
+			ceph_put_snap_context(folio_detach_private(folio));
+			folio_end_writeback(folio);
+			dout("unlocking %lu\n", folio->index);
 
 			if (remove_page)
 				generic_error_remove_page(inode->i_mapping,
-							  page);
+							  &folio->page);
 
-			unlock_page(page);
+			folio_unlock(folio);
 		}
 		dout("writepages_finish %p wrote %llu bytes cleaned %d pages\n",
 		     inode, osd_data->length, rc >= 0 ? num_pages : 0);