summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-26 23:19:49 -0400
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-08-02 12:34:02 -0400
commitb7a6eb22ba10f8f6104575dbbbe8c5ad36afd9ac (patch)
tree8fc7adb35da65d1f5f99acbdad61e7a4fc61735b
parent0b768a9610c6de9811c6d33900bebfb665192ee1 (diff)
downloadlinux-b7a6eb22ba10f8f6104575dbbbe8c5ad36afd9ac.tar.gz
buffer: Don't test folio error in block_read_full_folio()
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>
-rw-r--r--fs/buffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index a0214e3f90d3..ce9844d7c10f 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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);
 
@@ -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,
@@ -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;