@@ -4102,24 +4102,24 @@ static void write_dev_flush(struct btrfs_device *device)
/*
* If the flush bio has been submitted by write_dev_flush, wait for it.
- * Return false for any error, and true otherwise.
+ * Return true for any error, and false otherwise.
*/
static bool wait_dev_flush(struct btrfs_device *device)
{
struct bio *bio = &device->flush_bio;
if (!test_and_clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state))
- return true;
+ return false;
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 false;
+ return true;
}
- return true;
+ return false;
}
/*
@@ -4131,7 +4131,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 */
@@ -4160,8 +4159,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++;
}
A fixup for the patch: Btrfs: change wait_dev_flush() return type to bool v2 In v2: Fixes: Update write_dev_flush() to return false upon success and true upon errors. Remove the local variable ret in barrier_all_devices(). Correct the bug where errors_wait was incremented upon success. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- Dave, I am sending this patch as a fix-up while I am still waiting to hear whether patch 4/4 will be dropped. If you would prefer to have this series sent as v2 with patch 4/4 removed, I can do that. fs/btrfs/disk-io.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)