Message ID | 29145a990313cb8759b8131b07f29694cc183ab3.1676265001.git.naohiro.aota@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: fix unnecessary increment of read error stat on write error | expand |
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
On Mon, Feb 13, 2023 at 02:10:38PM +0900, Naohiro Aota wrote: > Current btrfs_log_dev_io_error() increases the read error count even if the > erroneous IO is a WRITE request. This is because it forget to use "else > if", and all the error WRITE requests counts as READ error as there is (of > course) no REQ_RAHEAD bit set. > > Fixes: c3a62baf21ad ("btrfs: use chained bios when cloning") > CC: stable@vger.kernel.org # 6.1 > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Added to misc-next, thanks.
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index d8b90f95b157..726592868e9c 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -287,7 +287,7 @@ static void btrfs_log_dev_io_error(struct bio *bio, struct btrfs_device *dev) if (btrfs_op(bio) == BTRFS_MAP_WRITE) btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); - if (!(bio->bi_opf & REQ_RAHEAD)) + else if (!(bio->bi_opf & REQ_RAHEAD)) btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_READ_ERRS); if (bio->bi_opf & REQ_PREFLUSH) btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_FLUSH_ERRS);
Current btrfs_log_dev_io_error() increases the read error count even if the erroneous IO is a WRITE request. This is because it forget to use "else if", and all the error WRITE requests counts as READ error as there is (of course) no REQ_RAHEAD bit set. Fixes: c3a62baf21ad ("btrfs: use chained bios when cloning") CC: stable@vger.kernel.org # 6.1 Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> --- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)