[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250812072225.181798-1-chizhiling@163.com>
Date: Tue, 12 Aug 2025 15:22:23 +0800
From: Chi Zhiling <chizhiling@....com>
To: linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>,
Matthew Wilcox <willy@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Namjae Jeon <linkinjeon@...nel.org>,
Sungjong Seo <sj1557.seo@...sung.com>,
Yuezhang Mo <yuezhang.mo@...y.com>,
Chi Zhiling <chizhiling@...inos.cn>
Subject: [PATCH 1/3] mpage: terminate read-ahead on read error
From: Chi Zhiling <chizhiling@...inos.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@...inos.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
Powered by blists - more mailing lists