Commit 6c1500f2 authored by Julia Lawall's avatar Julia Lawall Committed by Josef Bacik

fs/btrfs: drop if around WARN_ON

Just use WARN_ON rather than an if containing only WARN_ON(1).

A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e;
@@
- if (e) WARN_ON(1);
+ WARN_ON(e);
// </smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 31b1a2bd
...@@ -890,8 +890,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -890,8 +890,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
while (!list_empty(&prefs)) { while (!list_empty(&prefs)) {
ref = list_first_entry(&prefs, struct __prelim_ref, list); ref = list_first_entry(&prefs, struct __prelim_ref, list);
list_del(&ref->list); list_del(&ref->list);
if (ref->count < 0) WARN_ON(ref->count < 0);
WARN_ON(1);
if (ref->count && ref->root_id && ref->parent == 0) { if (ref->count && ref->root_id && ref->parent == 0) {
/* no parent == root of tree */ /* no parent == root of tree */
ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS);
......
...@@ -1464,10 +1464,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, ...@@ -1464,10 +1464,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
if (cache_only && parent_level != 1) if (cache_only && parent_level != 1)
return 0; return 0;
if (trans->transaction != root->fs_info->running_transaction) WARN_ON(trans->transaction != root->fs_info->running_transaction);
WARN_ON(1); WARN_ON(trans->transid != root->fs_info->generation);
if (trans->transid != root->fs_info->generation)
WARN_ON(1);
parent_nritems = btrfs_header_nritems(parent); parent_nritems = btrfs_header_nritems(parent);
blocksize = btrfs_level_size(root, parent_level - 1); blocksize = btrfs_level_size(root, parent_level - 1);
...@@ -3398,8 +3396,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans, ...@@ -3398,8 +3396,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
if (push_items == 0) if (push_items == 0)
goto out_unlock; goto out_unlock;
if (!empty && push_items == left_nritems) WARN_ON(!empty && push_items == left_nritems);
WARN_ON(1);
/* push left to right */ /* push left to right */
right_nritems = btrfs_header_nritems(right); right_nritems = btrfs_header_nritems(right);
......
...@@ -1675,8 +1675,7 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, ...@@ -1675,8 +1675,7 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end, int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
struct extent_state **cached_state) struct extent_state **cached_state)
{ {
if ((end & (PAGE_CACHE_SIZE - 1)) == 0) WARN_ON((end & (PAGE_CACHE_SIZE - 1)) == 0);
WARN_ON(1);
return set_extent_delalloc(&BTRFS_I(inode)->io_tree, start, end, return set_extent_delalloc(&BTRFS_I(inode)->io_tree, start, end,
cached_state, GFP_NOFS); cached_state, GFP_NOFS);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment