diff mbox series

[02/15] btrfs: Make WARN_ON in a canonical form

Message ID 20190130145102.4708-3-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series Improvements to fitrim | expand

Commit Message

Nikolay Borisov Jan. 30, 2019, 2:50 p.m. UTC
There is no point in using a construct like 'if (!condition)
WARN_ON(1)'. Use WARN_ON(!condition) directly. No functional changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent-tree.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

David Sterba Jan. 31, 2019, 3:22 p.m. UTC | #1
On Wed, Jan 30, 2019 at 04:50:49PM +0200, Nikolay Borisov wrote:
> There is no point in using a construct like 'if (!condition)
> WARN_ON(1)'. Use WARN_ON(!condition) directly. No functional changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
Johannes Thumshirn Feb. 4, 2019, 1:12 p.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox series

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fc3f6acc3c9b..79d0bc813a72 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -10798,13 +10798,10 @@  int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
 	}
 
 	spin_lock(&trans->transaction->dirty_bgs_lock);
-	if (!list_empty(&block_group->dirty_list)) {
-		WARN_ON(1);
-	}
-	if (!list_empty(&block_group->io_list)) {
-		WARN_ON(1);
-	}
+	WARN_ON(!list_empty(&block_group->dirty_list));
+	WARN_ON(!list_empty(&block_group->io_list));
 	spin_unlock(&trans->transaction->dirty_bgs_lock);
+
 	btrfs_remove_free_space_cache(block_group);
 
 	spin_lock(&block_group->space_info->lock);