[PATCH v3 3/8] md: introduce safe_put_folio for folio support in RAID
From: linan666
Date: Wed Apr 15 2026 - 23:52:26 EST
From: Li Nan <linan122@xxxxxxxxxx>
safe_put_page() will be removed after the last reference to it in RAID5
is removed.
Signed-off-by: Li Nan <linan122@xxxxxxxxxx>
---
drivers/md/md.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 914b992a073b..7c0c38f09cc3 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -888,6 +888,12 @@ struct md_io_clone {
rcu_read_unlock(); \
} while (0)
+static inline void safe_folio_put(struct folio *folio)
+{
+ if (folio)
+ folio_put(folio);
+}
+
static inline void safe_put_page(struct page *p)
{
if (p) put_page(p);
--
2.39.2