[PATCH] fs/dax: use page_ref_count() in dax_folio_put()
From: Nilay Vaish
Date: Mon Nov 23 2026 - 22:34:09 EST
Once dax_folio_reset_order() has turned a DAX folio back into single
pages, dax_folio_put() checks that none of them still holds a reference.
It does so by casting each struct page to struct folio and calling
folio_ref_count().
The cast relies on struct folio overlaying struct page. struct folio is
going to be allocated separately as part of the memdesc work, and casts
like this one have to go before that can happen.
page_ref_count() reads the same count from the page that the loop
already has, so use it.
No functional change.
Signed-off-by: Nilay Vaish <nilayvaish@xxxxxxxxxx>
---
Notes:
This patch was written with the help of an AI coding assistant (Gemini).
Based on next-20261123.
fs/dax.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dax.c b/fs/dax.c
index 9d161d7ef3ef..16cad82c689f 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -449,7 +449,7 @@ static inline unsigned long dax_folio_put(struct folio *folio)
for (i = 0; i < (1UL << order); i++) {
struct page *page = folio_page(folio, i);
- WARN_ON_ONCE(folio_ref_count((struct folio *)page));
+ WARN_ON_ONCE(page_ref_count(page));
}
return ref;
base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
--
2.56.1.839.g22a8290db9-goog