[PATCH 6/6] ceph: use folios in put_bvecs()
From: Tal Zussman
Date: Tue Aug 25 2026 - 17:51:20 EST
Use bvec_folio() to dirty and release the pages as folios. This adds
one call to compound_head() per page, while folio_mark_dirty_lock() and
folio_put() each drop one, for a net saving of one call per page when
dirtying.
Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
fs/ceph/file.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 0b6921293f27..89233c5905c9 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -182,11 +182,15 @@ static void put_bvecs(struct bio_vec *bvecs, int num_bvecs, bool should_dirty)
int i;
for (i = 0; i < num_bvecs; i++) {
- if (bvecs[i].bv_page) {
- if (should_dirty)
- set_page_dirty_lock(bvecs[i].bv_page);
- put_page(bvecs[i].bv_page);
- }
+ struct folio *folio;
+
+ if (!bvecs[i].bv_page)
+ continue;
+
+ folio = bvec_folio(&bvecs[i]);
+ if (should_dirty)
+ folio_mark_dirty_lock(folio);
+ folio_put(folio);
}
kvfree(bvecs);
}
--
2.39.5