Skip to content

Commit

Permalink
fs: convert clean_buffers() to take a folio
Browse files Browse the repository at this point in the history
The only caller already has a folio, so pass it in and use it throughout. 
Saves two calls to compound_head().

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jens Axboe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Matthew Wilcox (Oracle) authored and akpm00 committed Dec 29, 2023
1 parent f099c96 commit e8ff824
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fs/mpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ struct mpage_data {
* We have our BIO, so we can now mark the buffers clean. Make
* sure to only clean buffers which we know we'll be writing.
*/
static void clean_buffers(struct page *page, unsigned first_unmapped)
static void clean_buffers(struct folio *folio, unsigned first_unmapped)
{
unsigned buffer_counter = 0;
struct buffer_head *bh, *head;
if (!page_has_buffers(page))
struct buffer_head *bh, *head = folio_buffers(folio);

if (!head)
return;
head = page_buffers(page);
bh = head;

do {
Expand All @@ -451,8 +451,8 @@ static void clean_buffers(struct page *page, unsigned first_unmapped)
* read_folio would fail to serialize with the bh and it would read from
* disk before we reach the platter.
*/
if (buffer_heads_over_limit && PageUptodate(page))
try_to_free_buffers(page_folio(page));
if (buffer_heads_over_limit && folio_test_uptodate(folio))
try_to_free_buffers(folio);
}

static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc,
Expand Down Expand Up @@ -615,7 +615,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc,
goto alloc_new;
}

clean_buffers(&folio->page, first_unmapped);
clean_buffers(folio, first_unmapped);

BUG_ON(folio_test_writeback(folio));
folio_start_writeback(folio);
Expand Down

0 comments on commit e8ff824

Please sign in to comment.