Btrfs: don't count I/O statistic read errors for missing devices

It is normal behaviour of the low level btrfs function btrfs_map_bio()
to complete a bio with -EIO if the device is missing, instead of just
preventing the bio creation in an earlier step.
This used to cause I/O statistic read error increments and annoying
printk_ratelimited messages. This commit fixes the issue.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reported-by: Carey Underwood <cwillu@cwillu.com>
This commit is contained in:
Stefan Behrens 2012-06-14 16:42:31 +02:00 committed by Chris Mason
parent d42244a0d3
commit 597a60fade
1 changed files with 12 additions and 10 deletions

View File

@ -4061,16 +4061,18 @@ static void btrfs_end_bio(struct bio *bio, int err)
BUG_ON(stripe_index >= bbio->num_stripes); BUG_ON(stripe_index >= bbio->num_stripes);
dev = bbio->stripes[stripe_index].dev; dev = bbio->stripes[stripe_index].dev;
if (bio->bi_rw & WRITE) if (dev->bdev) {
btrfs_dev_stat_inc(dev, if (bio->bi_rw & WRITE)
BTRFS_DEV_STAT_WRITE_ERRS); btrfs_dev_stat_inc(dev,
else BTRFS_DEV_STAT_WRITE_ERRS);
btrfs_dev_stat_inc(dev, else
BTRFS_DEV_STAT_READ_ERRS); btrfs_dev_stat_inc(dev,
if ((bio->bi_rw & WRITE_FLUSH) == WRITE_FLUSH) BTRFS_DEV_STAT_READ_ERRS);
btrfs_dev_stat_inc(dev, if ((bio->bi_rw & WRITE_FLUSH) == WRITE_FLUSH)
BTRFS_DEV_STAT_FLUSH_ERRS); btrfs_dev_stat_inc(dev,
btrfs_dev_stat_print_on_error(dev); BTRFS_DEV_STAT_FLUSH_ERRS);
btrfs_dev_stat_print_on_error(dev);
}
} }
} }