Skip to content

Commit 66b4993

Browse files
committed
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 <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 2980d57 commit 66b4993

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

fs/btrfs/disk-io.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,7 +3512,6 @@ static void write_dev_flush(struct btrfs_device *device)
35123512
*/
35133513
static int wait_dev_flush(struct btrfs_device *device)
35143514
{
3515-
int ret = 0;
35163515
struct bio *bio = device->flush_bio;
35173516

35183517
if (!device->flush_bio_sent)
@@ -3521,13 +3520,7 @@ static int wait_dev_flush(struct btrfs_device *device)
35213520
device->flush_bio_sent = 0;
35223521
wait_for_completion_io(&device->flush_wait);
35233522

3524-
if (bio->bi_error) {
3525-
ret = bio->bi_error;
3526-
btrfs_dev_stat_inc_and_print(device,
3527-
BTRFS_DEV_STAT_FLUSH_ERRS);
3528-
}
3529-
3530-
return ret;
3523+
return bio->bi_error;
35313524
}
35323525

35333526
static int check_barrier_error(struct btrfs_fs_devices *fsdevs)
@@ -3586,6 +3579,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
35863579
ret = wait_dev_flush(dev);
35873580
if (ret) {
35883581
dev->last_flush_error = ret;
3582+
btrfs_dev_stat_inc_and_print(dev,
3583+
BTRFS_DEV_STAT_FLUSH_ERRS);
35893584
errors_wait++;
35903585
}
35913586
}

0 commit comments

Comments
 (0)