mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
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>
This commit is contained in:
parent
ebb7205efe
commit
5d0f54ab92
|
|
@ -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;
|
||||
struct folio *folio = page_folio(page);
|
||||
struct buffer_head *bh = folio_detach_private(folio);
|
||||
|
||||
if (!PagePrivate(page))
|
||||
return;
|
||||
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user