linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mpage: terminate read-ahead on read error
@ 2025-08-12  7:22 Chi Zhiling
  2025-08-12  7:22 ` [PATCH 2/3] mpage: clean up do_mpage_readpage() Chi Zhiling
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chi Zhiling @ 2025-08-12  7:22 UTC (permalink / raw)
  To: linux-fsdevel, linux-mm, linux-kernel
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Matthew Wilcox,
	Andrew Morton, Namjae Jeon, Sungjong Seo, Yuezhang Mo,
	Chi Zhiling

From: Chi Zhiling <chizhiling@kylinos.cn>

For exFAT filesystems with 4MB read_ahead_size, removing the storage device
during read operations can delay EIO error reporting by several minutes.
This occurs because the read-ahead implementation in mpage doesn't handle
errors.

Another reason for the delay is that the filesystem requires metadata to
issue file read request. When the storage device is removed, the metadata
buffers are invalidated, causing mpage to repeatedly attempt to fetch
metadata during each get_block call.

The original purpose of this patch is terminate read ahead when we fail
to get metadata, to make the patch more generic, implement it by checking
folio status, instead of checking the return of get_block().

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
---
 fs/mpage.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/mpage.c b/fs/mpage.c
index c5fd821fd30e..b6510b8dfa2b 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -369,6 +369,9 @@ void mpage_readahead(struct readahead_control *rac, get_block_t get_block)
 		args.folio = folio;
 		args.nr_pages = readahead_count(rac);
 		args.bio = do_mpage_readpage(&args);
+		if (!folio_test_locked(folio) &&
+		    !folio_test_uptodate(folio))
+			break;
 	}
 	if (args.bio)
 		mpage_bio_submit_read(args.bio);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-19 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12  7:22 [PATCH 1/3] mpage: terminate read-ahead on read error Chi Zhiling
2025-08-12  7:22 ` [PATCH 2/3] mpage: clean up do_mpage_readpage() Chi Zhiling
2025-08-12  7:22 ` [PATCH 3/3] mpage: convert do_mpage_readpage() to return int type Chi Zhiling
2025-08-18  2:41 ` [PATCH 1/3] mpage: terminate read-ahead on read error Andrew Morton
2025-08-18 10:04   ` Chi Zhiling
2025-08-18 14:33     ` Matthew Wilcox
2025-08-19 12:22       ` Chi Zhiling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).