[PATCH v3 2/7] fs/dax: Use folio_split_unref helper
From: Francois Dugast
Date: Fri Jan 09 2026 - 03:57:46 EST
From: Matthew Brost <matthew.brost@xxxxxxxxx>
Use folio_split_unref helper to split a folio into individual upon final
put of a fsdax page.
Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Cc: nvdimm@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Suggested-by: Alistair Popple <apopple@xxxxxxxxxx>
Signed-off-by: Matthew Brost <matthew.brost@xxxxxxxxx>
Signed-off-by: Francois Dugast <francois.dugast@xxxxxxxxx>
---
fs/dax.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index 289e6254aa30..90ec68785f40 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -381,7 +381,6 @@ static void dax_folio_make_shared(struct folio *folio)
static inline unsigned long dax_folio_put(struct folio *folio)
{
unsigned long ref;
- int order, i;
if (!dax_folio_is_shared(folio))
ref = 0;
@@ -391,29 +390,7 @@ static inline unsigned long dax_folio_put(struct folio *folio)
if (ref)
return ref;
- folio->mapping = NULL;
- order = folio_order(folio);
- if (!order)
- return 0;
- folio_reset_order(folio);
-
- for (i = 0; i < (1UL << order); i++) {
- struct dev_pagemap *pgmap = page_pgmap(&folio->page);
- struct page *page = folio_page(folio, i);
- struct folio *new_folio = (struct folio *)page;
-
- ClearPageHead(page);
- clear_compound_head(page);
-
- new_folio->mapping = NULL;
- /*
- * Reset pgmap which was over-written by
- * prep_compound_page().
- */
- new_folio->pgmap = pgmap;
- new_folio->share = 0;
- WARN_ON_ONCE(folio_ref_count(new_folio));
- }
+ folio_split_unref(folio);
return ref;
}
--
2.43.0