1 From 0cc068e6ee59c1fffbfa977d8bf868b7551d80ac Mon Sep 17 00:00:00 2001
2 From: David Sterba <dsterba@suse.com>
3 Date: Thu, 7 Mar 2019 15:40:50 +0100
4 Subject: btrfs: don't report readahead errors and don't update statistics
6 From: David Sterba <dsterba@suse.com>
8 commit 0cc068e6ee59c1fffbfa977d8bf868b7551d80ac upstream.
10 As readahead is an optimization, all errors are usually filtered out,
11 but still properly handled when the real read call is done. The commit
12 5e9d398240b2 ("btrfs: readpages() should submit IO as read-ahead") added
13 REQ_RAHEAD to readpages() because that's only used for readahead
14 (despite what one would expect from the callback name).
16 This causes a flood of messages and inflated read error stats, so skip
17 reporting in case it's readahead.
19 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202403
20 Reported-by: LimeTech <tomm@lime-technology.com>
21 Fixes: 5e9d398240b2 ("btrfs: readpages() should submit IO as read-ahead")
22 CC: stable@vger.kernel.org # 4.19+
23 Signed-off-by: David Sterba <dsterba@suse.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 fs/btrfs/volumes.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
30 --- a/fs/btrfs/volumes.c
31 +++ b/fs/btrfs/volumes.c
32 @@ -6051,7 +6051,7 @@ static void btrfs_end_bio(struct bio *bi
33 if (bio_op(bio) == REQ_OP_WRITE)
34 btrfs_dev_stat_inc_and_print(dev,
35 BTRFS_DEV_STAT_WRITE_ERRS);
37 + else if (!(bio->bi_opf & REQ_RAHEAD))
38 btrfs_dev_stat_inc_and_print(dev,
39 BTRFS_DEV_STAT_READ_ERRS);
40 if (bio->bi_opf & REQ_PREFLUSH)