diff mbox series

fixup: Btrfs: change wait_dev_flush() return type to bool v2

Message ID be5e43a3f8333200a69ba85e9c62eb943871c811.1679980900.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series fixup: Btrfs: change wait_dev_flush() return type to bool v2 | expand

Commit Message

Anand Jain March 28, 2023, 5:31 a.m. UTC
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(-)

Comments

David Sterba March 28, 2023, 6:28 p.m. UTC | #1
On Tue, Mar 28, 2023 at 01:31:27PM +0800, Anand Jain wrote:
> 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.

Ok let's do test_and_clear(), I'll fold the fixup and add the series to
misc-next. Thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1f9e2a2a8267..a240e77448e0 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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++;
 	}