mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-29 17:35:36 -04:00
btrfs: change wait_dev_flush() return type to bool
The flush error code is maintained in btrfs_device::last_flush_error, so there is no point in returning it in wait_dev_flush() when it is not being used. Instead, we can return a boolean value. Note that even though btrfs_device::last_flush_error may not be used, we will keep it for now. 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:
@@ -4116,13 +4116,14 @@ static void write_dev_flush(struct btrfs_device *device)
|
||||
|
||||
/*
|
||||
* If the flush bio has been submitted by write_dev_flush, wait for it.
|
||||
* Return true for any error, and false otherwise.
|
||||
*/
|
||||
static blk_status_t wait_dev_flush(struct btrfs_device *device)
|
||||
static bool wait_dev_flush(struct btrfs_device *device)
|
||||
{
|
||||
struct bio *bio = &device->flush_bio;
|
||||
|
||||
if (!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state))
|
||||
return BLK_STS_OK;
|
||||
return false;
|
||||
|
||||
clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
|
||||
wait_for_completion_io(&device->flush_wait);
|
||||
@@ -4130,9 +4131,10 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
|
||||
if (bio->bi_status) {
|
||||
device->last_flush_error = bio->bi_status;
|
||||
btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_FLUSH_ERRS);
|
||||
return true;
|
||||
}
|
||||
|
||||
return bio->bi_status;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4144,7 +4146,6 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
|
||||
struct list_head *head;
|
||||
struct btrfs_device *dev;
|
||||
int errors_wait = 0;
|
||||
blk_status_t ret;
|
||||
|
||||
lockdep_assert_held(&info->fs_devices->device_list_mutex);
|
||||
/* send down all the barriers */
|
||||
@@ -4173,8 +4174,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
|
||||
!test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state))
|
||||
continue;
|
||||
|
||||
ret = wait_dev_flush(dev);
|
||||
if (ret)
|
||||
if (wait_dev_flush(dev))
|
||||
errors_wait++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user