mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 06:08:07 +00:00
btrfs: move dev stats accounting out of wait_dev_flush
We should really just wait in wait_dev_flush and let the caller decide what to do with the error value. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
2980d5745f
commit
66b4993e95
1 changed files with 3 additions and 8 deletions
|
@ -3512,7 +3512,6 @@ static void write_dev_flush(struct btrfs_device *device)
|
||||||
*/
|
*/
|
||||||
static int wait_dev_flush(struct btrfs_device *device)
|
static int wait_dev_flush(struct btrfs_device *device)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
struct bio *bio = device->flush_bio;
|
struct bio *bio = device->flush_bio;
|
||||||
|
|
||||||
if (!device->flush_bio_sent)
|
if (!device->flush_bio_sent)
|
||||||
|
@ -3521,13 +3520,7 @@ static int wait_dev_flush(struct btrfs_device *device)
|
||||||
device->flush_bio_sent = 0;
|
device->flush_bio_sent = 0;
|
||||||
wait_for_completion_io(&device->flush_wait);
|
wait_for_completion_io(&device->flush_wait);
|
||||||
|
|
||||||
if (bio->bi_error) {
|
return bio->bi_error;
|
||||||
ret = bio->bi_error;
|
|
||||||
btrfs_dev_stat_inc_and_print(device,
|
|
||||||
BTRFS_DEV_STAT_FLUSH_ERRS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_barrier_error(struct btrfs_fs_devices *fsdevs)
|
static int check_barrier_error(struct btrfs_fs_devices *fsdevs)
|
||||||
|
@ -3586,6 +3579,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
|
||||||
ret = wait_dev_flush(dev);
|
ret = wait_dev_flush(dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev->last_flush_error = ret;
|
dev->last_flush_error = ret;
|
||||||
|
btrfs_dev_stat_inc_and_print(dev,
|
||||||
|
BTRFS_DEV_STAT_FLUSH_ERRS);
|
||||||
errors_wait++;
|
errors_wait++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue