fs/btrfs: use WARN
Use WARN rather than printk followed by WARN_ON(1), for conciseness. A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression list es; @@ -printk( +WARN(1, es); -WARN_ON(1); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
5269b67e3d
commit
31b1a2bd75
|
@ -1359,19 +1359,16 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,
|
||||||
u64 search_start;
|
u64 search_start;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (trans->transaction != root->fs_info->running_transaction) {
|
if (trans->transaction != root->fs_info->running_transaction)
|
||||||
printk(KERN_CRIT "trans %llu running %llu\n",
|
WARN(1, KERN_CRIT "trans %llu running %llu\n",
|
||||||
(unsigned long long)trans->transid,
|
(unsigned long long)trans->transid,
|
||||||
(unsigned long long)
|
(unsigned long long)
|
||||||
root->fs_info->running_transaction->transid);
|
root->fs_info->running_transaction->transid);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
if (trans->transid != root->fs_info->generation)
|
||||||
if (trans->transid != root->fs_info->generation) {
|
WARN(1, KERN_CRIT "trans %llu running %llu\n",
|
||||||
printk(KERN_CRIT "trans %llu running %llu\n",
|
|
||||||
(unsigned long long)trans->transid,
|
(unsigned long long)trans->transid,
|
||||||
(unsigned long long)root->fs_info->generation);
|
(unsigned long long)root->fs_info->generation);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!should_cow_block(trans, root, buf)) {
|
if (!should_cow_block(trans, root, buf)) {
|
||||||
*cow_ret = buf;
|
*cow_ret = buf;
|
||||||
|
@ -3640,11 +3637,9 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
|
||||||
btrfs_set_header_nritems(left, old_left_nritems + push_items);
|
btrfs_set_header_nritems(left, old_left_nritems + push_items);
|
||||||
|
|
||||||
/* fixup right node */
|
/* fixup right node */
|
||||||
if (push_items > right_nritems) {
|
if (push_items > right_nritems)
|
||||||
printk(KERN_CRIT "push items %d nr %u\n", push_items,
|
WARN(1, KERN_CRIT "push items %d nr %u\n", push_items,
|
||||||
right_nritems);
|
right_nritems);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (push_items < right_nritems) {
|
if (push_items < right_nritems) {
|
||||||
push_space = btrfs_item_offset_nr(right, push_items - 1) -
|
push_space = btrfs_item_offset_nr(right, push_items - 1) -
|
||||||
|
|
|
@ -3397,14 +3397,12 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
|
||||||
int was_dirty;
|
int was_dirty;
|
||||||
|
|
||||||
btrfs_assert_tree_locked(buf);
|
btrfs_assert_tree_locked(buf);
|
||||||
if (transid != root->fs_info->generation) {
|
if (transid != root->fs_info->generation)
|
||||||
printk(KERN_CRIT "btrfs transid mismatch buffer %llu, "
|
WARN(1, KERN_CRIT "btrfs transid mismatch buffer %llu, "
|
||||||
"found %llu running %llu\n",
|
"found %llu running %llu\n",
|
||||||
(unsigned long long)buf->start,
|
(unsigned long long)buf->start,
|
||||||
(unsigned long long)transid,
|
(unsigned long long)transid,
|
||||||
(unsigned long long)root->fs_info->generation);
|
(unsigned long long)root->fs_info->generation);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
|
||||||
was_dirty = set_extent_buffer_dirty(buf);
|
was_dirty = set_extent_buffer_dirty(buf);
|
||||||
if (!was_dirty) {
|
if (!was_dirty) {
|
||||||
spin_lock(&root->fs_info->delalloc_lock);
|
spin_lock(&root->fs_info->delalloc_lock);
|
||||||
|
|
|
@ -6292,10 +6292,9 @@ use_block_rsv(struct btrfs_trans_handle *trans,
|
||||||
static DEFINE_RATELIMIT_STATE(_rs,
|
static DEFINE_RATELIMIT_STATE(_rs,
|
||||||
DEFAULT_RATELIMIT_INTERVAL,
|
DEFAULT_RATELIMIT_INTERVAL,
|
||||||
/*DEFAULT_RATELIMIT_BURST*/ 2);
|
/*DEFAULT_RATELIMIT_BURST*/ 2);
|
||||||
if (__ratelimit(&_rs)) {
|
if (__ratelimit(&_rs))
|
||||||
printk(KERN_DEBUG "btrfs: block rsv returned %d\n", ret);
|
WARN(1, KERN_DEBUG "btrfs: block rsv returned %d\n",
|
||||||
WARN_ON(1);
|
ret);
|
||||||
}
|
|
||||||
ret = reserve_metadata_bytes(root, block_rsv, blocksize,
|
ret = reserve_metadata_bytes(root, block_rsv, blocksize,
|
||||||
BTRFS_RESERVE_NO_FLUSH);
|
BTRFS_RESERVE_NO_FLUSH);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
|
@ -341,12 +341,10 @@ static int insert_state(struct extent_io_tree *tree,
|
||||||
{
|
{
|
||||||
struct rb_node *node;
|
struct rb_node *node;
|
||||||
|
|
||||||
if (end < start) {
|
if (end < start)
|
||||||
printk(KERN_ERR "btrfs end < start %llu %llu\n",
|
WARN(1, KERN_ERR "btrfs end < start %llu %llu\n",
|
||||||
(unsigned long long)end,
|
(unsigned long long)end,
|
||||||
(unsigned long long)start);
|
(unsigned long long)start);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
|
||||||
state->start = start;
|
state->start = start;
|
||||||
state->end = end;
|
state->end = end;
|
||||||
|
|
||||||
|
@ -4721,10 +4719,9 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start + min_len > eb->len) {
|
if (start + min_len > eb->len) {
|
||||||
printk(KERN_ERR "btrfs bad mapping eb start %llu len %lu, "
|
WARN(1, KERN_ERR "btrfs bad mapping eb start %llu len %lu, "
|
||||||
"wanted %lu %lu\n", (unsigned long long)eb->start,
|
"wanted %lu %lu\n", (unsigned long long)eb->start,
|
||||||
eb->len, start, min_len);
|
eb->len, start, min_len);
|
||||||
WARN_ON(1);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5458,8 +5458,7 @@ again:
|
||||||
extent_map_end(em) - 1, NULL, GFP_NOFS);
|
extent_map_end(em) - 1, NULL, GFP_NOFS);
|
||||||
goto insert;
|
goto insert;
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_ERR "btrfs unknown found_type %d\n", found_type);
|
WARN(1, KERN_ERR "btrfs unknown found_type %d\n", found_type);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
}
|
||||||
not_found:
|
not_found:
|
||||||
em->start = start;
|
em->start = start;
|
||||||
|
|
|
@ -145,16 +145,12 @@ loop:
|
||||||
* the log must never go across transaction boundaries.
|
* the log must never go across transaction boundaries.
|
||||||
*/
|
*/
|
||||||
smp_mb();
|
smp_mb();
|
||||||
if (!list_empty(&fs_info->tree_mod_seq_list)) {
|
if (!list_empty(&fs_info->tree_mod_seq_list))
|
||||||
printk(KERN_ERR "btrfs: tree_mod_seq_list not empty when "
|
WARN(1, KERN_ERR "btrfs: tree_mod_seq_list not empty when "
|
||||||
"creating a fresh transaction\n");
|
"creating a fresh transaction\n");
|
||||||
WARN_ON(1);
|
if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log))
|
||||||
}
|
WARN(1, KERN_ERR "btrfs: tree_mod_log rb tree not empty when "
|
||||||
if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log)) {
|
|
||||||
printk(KERN_ERR "btrfs: tree_mod_log rb tree not empty when "
|
|
||||||
"creating a fresh transaction\n");
|
"creating a fresh transaction\n");
|
||||||
WARN_ON(1);
|
|
||||||
}
|
|
||||||
atomic_set(&fs_info->tree_mod_seq, 0);
|
atomic_set(&fs_info->tree_mod_seq, 0);
|
||||||
|
|
||||||
spin_lock_init(&cur_trans->commit_lock);
|
spin_lock_init(&cur_trans->commit_lock);
|
||||||
|
|
|
@ -3323,9 +3323,8 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
|
|
||||||
if (!device->writeable) {
|
if (!device->writeable) {
|
||||||
printk(KERN_ERR
|
WARN(1, KERN_ERR
|
||||||
"btrfs: read-only device in alloc_list\n");
|
"btrfs: read-only device in alloc_list\n");
|
||||||
WARN_ON(1);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue