Skip to contentSkip to conversation

dm-crypt: use folio_nr_pages() instead of shift operation

PATCH New Pedro Demarchi Gomes 1 participant 1 message Oct 4, 2025 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-crypt: use folio_nr_pages() instead of shift operation

folio_nr_pages() is a faster helper function to get the number of pages when NR_PAGES_IN_LARGE_FOLIO is enabled.

---
 drivers/md/dm-crypt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
index 5ef43231fe77..a1025bb29ebd 100644
@@ -1781,7 +1781,7 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone)
 		bio_for_each_folio_all(fi, clone) {
 			if (folio_test_large(fi.folio)) {
 				percpu_counter_sub(&cc->n_allocated_pages,
-						1 << folio_order(fi.folio));
+						folio_nr_pages(fi.folio));
 				folio_put(fi.folio);
 			} else {
 				mempool_free(&fi.folio->page, &cc->page_pool);
Signature · 1 line
2.39.5