summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2026-09-20 22:28:10 -0400
committerAndrew Morton <akpm@linux-foundation.org>2026-10-08 22:55:17 -0700
commit5d0f54ab925f02df9537a01618dfca00ff05ad2f (patch)
treef980c2fe58a164d1b0fb2948ba24456e05c3a59c /drivers/md
parentebb7205efe614a8527f45b797f29d368a67b15a1 (diff)
md: use folio APIs in free_page()
Convert the page to a folio. This removes some of the last uses of a few page APIs (detach_page_private(), page_buffers()). Replaces two calls to compound_head() with one. Remove the early return in free_buffers() to avoid memory leak and uninitialized file bitmap pages.[1][2] [ziy@nvidia.com: drop early return] Link: https://lore.kernel.org/20260920-remove-pg_private-v5-14-bb68b6a21869@nvidia.com Link: https://sashiko.dev/#/patchset/20260913-remove-pg_private-v4-0-848550f7574e%40nvidia.com?part=2 [1] Link: https://lore.kernel.org/all/aqgfA0QFi98gXYG2@casper.infradead.org/ [2] Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md-bitmap.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 5f1637f974c1..02a126968ad4 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -533,19 +533,15 @@ static void write_file_page(struct bitmap *bitmap, struct page *page, int wait)
static void free_buffers(struct page *page)
{
- struct buffer_head *bh;
-
- if (!PagePrivate(page))
- return;
+ struct folio *folio = page_folio(page);
+ struct buffer_head *bh = folio_detach_private(folio);
- bh = page_buffers(page);
while (bh) {
struct buffer_head *next = bh->b_this_page;
free_buffer_head(bh);
bh = next;
}
- detach_page_private(page);
- put_page(page);
+ folio_put(folio);
}
/* read a page from a file.