Skip to contentSkip to conversation

fs/dax: use page_ref_count() in dax_folio_put()

PATCH New Nilay Vaish 1 participant 1 message Nov 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/dax: use page_ref_count() in dax_folio_put()

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.

---

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(-)
fs/dax.c +1 -1
index 9d161d7ef3ef..16cad82c689f 100644
@@ -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

Signature · 1 line
2.56.1.839.g22a8290db9-goog