Skip to content

Commit

Permalink
buffer: Don't test folio error in block_read_full_folio()
Browse files Browse the repository at this point in the history
We can cache this information in a local variable instead of communicating
from one part of the function to another via folio flags.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
  • Loading branch information
Matthew Wilcox (Oracle) committed Aug 2, 2022
1 parent 0b768a9 commit b7a6eb2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2259,6 +2259,7 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
unsigned int blocksize, bbits;
int nr, i;
int fully_mapped = 1;
bool page_error = false;

VM_BUG_ON_FOLIO(folio_test_large(folio), folio);

Expand All @@ -2283,8 +2284,10 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
if (iblock < lblock) {
WARN_ON(bh->b_size != blocksize);
err = get_block(inode, iblock, bh, 0);
if (err)
if (err) {
folio_set_error(folio);
page_error = true;
}
}
if (!buffer_mapped(bh)) {
folio_zero_range(folio, i * blocksize,
Expand All @@ -2311,7 +2314,7 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
* All buffers are uptodate - we can set the folio uptodate
* as well. But not if get_block() returned an error.
*/
if (!folio_test_error(folio))
if (!page_error)
folio_mark_uptodate(folio);
folio_unlock(folio);
return 0;
Expand Down

0 comments on commit b7a6eb2

Please sign in to comment.