mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 10:10:33 +02:00
btrfs: move last_flush_error to write_dev_flush and wait_dev_flush
We parallelize the flush command across devices using our own code, write_dev_flush() sends the flush command to each device and wait_dev_flush() waits for the flush to complete on all devices. Errors from each device are recorded at device->last_flush_error and reset to BLK_STS_OK in write_dev_flush() and to the error, if any, in wait_dev_flush(). These functions are called from barrier_all_devices(). This patch consolidates the use of device->last_flush_error in write_dev_flush() and wait_dev_flush() to remove it from barrier_all_devices(). Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b7b1167c36
commit
bfd3ea946f
1 changed files with 8 additions and 6 deletions
|
|
@ -4086,6 +4086,8 @@ static void write_dev_flush(struct btrfs_device *device)
|
||||||
{
|
{
|
||||||
struct bio *bio = &device->flush_bio;
|
struct bio *bio = &device->flush_bio;
|
||||||
|
|
||||||
|
device->last_flush_error = BLK_STS_OK;
|
||||||
|
|
||||||
#ifndef CONFIG_BTRFS_FS_CHECK_INTEGRITY
|
#ifndef CONFIG_BTRFS_FS_CHECK_INTEGRITY
|
||||||
/*
|
/*
|
||||||
* When a disk has write caching disabled, we skip submission of a bio
|
* When a disk has write caching disabled, we skip submission of a bio
|
||||||
|
|
@ -4125,6 +4127,11 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
|
||||||
clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
|
clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
|
||||||
wait_for_completion_io(&device->flush_wait);
|
wait_for_completion_io(&device->flush_wait);
|
||||||
|
|
||||||
|
if (bio->bi_status) {
|
||||||
|
device->last_flush_error = bio->bi_status;
|
||||||
|
btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_FLUSH_ERRS);
|
||||||
|
}
|
||||||
|
|
||||||
return bio->bi_status;
|
return bio->bi_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4159,7 +4166,6 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
write_dev_flush(dev);
|
write_dev_flush(dev);
|
||||||
dev->last_flush_error = BLK_STS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for all the barriers */
|
/* wait for all the barriers */
|
||||||
|
|
@ -4175,13 +4181,9 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = wait_dev_flush(dev);
|
ret = wait_dev_flush(dev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
dev->last_flush_error = ret;
|
|
||||||
btrfs_dev_stat_inc_and_print(dev,
|
|
||||||
BTRFS_DEV_STAT_FLUSH_ERRS);
|
|
||||||
errors_wait++;
|
errors_wait++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (errors_wait) {
|
if (errors_wait) {
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue