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

buffer: use b_folio in end_buffer_async_read()

Removes a call to compound_head() in SetPageError(), saving 76 bytes of
text.

Link: https://lkml.kernel.org/r/20221215214402.3522366-5-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 03c5f331
...@@ -246,18 +246,18 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -246,18 +246,18 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
unsigned long flags; unsigned long flags;
struct buffer_head *first; struct buffer_head *first;
struct buffer_head *tmp; struct buffer_head *tmp;
struct page *page; struct folio *folio;
int page_uptodate = 1; int folio_uptodate = 1;
BUG_ON(!buffer_async_read(bh)); BUG_ON(!buffer_async_read(bh));
page = bh->b_page; folio = bh->b_folio;
if (uptodate) { if (uptodate) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} else { } else {
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
buffer_io_error(bh, ", async page read"); buffer_io_error(bh, ", async page read");
SetPageError(page); folio_set_error(folio);
} }
/* /*
...@@ -265,14 +265,14 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -265,14 +265,14 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
* two buffer heads end IO at almost the same time and both * two buffer heads end IO at almost the same time and both
* decide that the page is now completely done. * decide that the page is now completely done.
*/ */
first = page_buffers(page); first = folio_buffers(folio);
spin_lock_irqsave(&first->b_uptodate_lock, flags); spin_lock_irqsave(&first->b_uptodate_lock, flags);
clear_buffer_async_read(bh); clear_buffer_async_read(bh);
unlock_buffer(bh); unlock_buffer(bh);
tmp = bh; tmp = bh;
do { do {
if (!buffer_uptodate(tmp)) if (!buffer_uptodate(tmp))
page_uptodate = 0; folio_uptodate = 0;
if (buffer_async_read(tmp)) { if (buffer_async_read(tmp)) {
BUG_ON(!buffer_locked(tmp)); BUG_ON(!buffer_locked(tmp));
goto still_busy; goto still_busy;
...@@ -285,9 +285,9 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -285,9 +285,9 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
* If all of the buffers are uptodate then we can set the page * If all of the buffers are uptodate then we can set the page
* uptodate. * uptodate.
*/ */
if (page_uptodate) if (folio_uptodate)
SetPageUptodate(page); folio_mark_uptodate(folio);
unlock_page(page); folio_unlock(folio);
return; return;
still_busy: still_busy:
......
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