Commit e8ff8248 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

fs: convert clean_buffers() to take a folio

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/20231215200245.748418-3-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f099c961
...@@ -430,13 +430,13 @@ struct mpage_data { ...@@ -430,13 +430,13 @@ struct mpage_data {
* We have our BIO, so we can now mark the buffers clean. Make * 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. * 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; unsigned buffer_counter = 0;
struct buffer_head *bh, *head; struct buffer_head *bh, *head = folio_buffers(folio);
if (!page_has_buffers(page))
if (!head)
return; return;
head = page_buffers(page);
bh = head; bh = head;
do { do {
...@@ -451,8 +451,8 @@ static void clean_buffers(struct page *page, unsigned first_unmapped) ...@@ -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 * read_folio would fail to serialize with the bh and it would read from
* disk before we reach the platter. * disk before we reach the platter.
*/ */
if (buffer_heads_over_limit && PageUptodate(page)) if (buffer_heads_over_limit && folio_test_uptodate(folio))
try_to_free_buffers(page_folio(page)); try_to_free_buffers(folio);
} }
static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc,
...@@ -615,7 +615,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, ...@@ -615,7 +615,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc,
goto alloc_new; goto alloc_new;
} }
clean_buffers(&folio->page, first_unmapped); clean_buffers(folio, first_unmapped);
BUG_ON(folio_test_writeback(folio)); BUG_ON(folio_test_writeback(folio));
folio_start_writeback(folio); folio_start_writeback(folio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment