diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2011-05-19 01:19:08 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-23 13:24:39 -0400 |
commit | 1cd307990d6e2b4965620e339a92e0d7ae853e13 (patch) | |
tree | cd3cc9c06e2c7bbbeda4d38bbcc00d44bfd98a02 /fs/btrfs | |
parent | 65a246c5ffe3b487a001de025816326939e63362 (diff) |
Btrfs: BUG_ON is deleted from the caller of btrfs_truncate_item & btrfs_extend_item
Currently, btrfs_truncate_item and btrfs_extend_item returns only 0.
So, the check by BUG_ON in the caller is unnecessary.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/dir-item.c | 1 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 3 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode-item.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 1 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 1 |
7 files changed, 2 insertions, 17 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 84d7ca1fe0ba..6f1a59cc41ff 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -3216,7 +3216,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans, | |||
3216 | struct btrfs_path *path, | 3216 | struct btrfs_path *path, |
3217 | u32 new_size, int from_end) | 3217 | u32 new_size, int from_end) |
3218 | { | 3218 | { |
3219 | int ret = 0; | ||
3220 | int slot; | 3219 | int slot; |
3221 | struct extent_buffer *leaf; | 3220 | struct extent_buffer *leaf; |
3222 | struct btrfs_item *item; | 3221 | struct btrfs_item *item; |
@@ -3314,12 +3313,11 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans, | |||
3314 | btrfs_set_item_size(leaf, item, new_size); | 3313 | btrfs_set_item_size(leaf, item, new_size); |
3315 | btrfs_mark_buffer_dirty(leaf); | 3314 | btrfs_mark_buffer_dirty(leaf); |
3316 | 3315 | ||
3317 | ret = 0; | ||
3318 | if (btrfs_leaf_free_space(root, leaf) < 0) { | 3316 | if (btrfs_leaf_free_space(root, leaf) < 0) { |
3319 | btrfs_print_leaf(root, leaf); | 3317 | btrfs_print_leaf(root, leaf); |
3320 | BUG(); | 3318 | BUG(); |
3321 | } | 3319 | } |
3322 | return ret; | 3320 | return 0; |
3323 | } | 3321 | } |
3324 | 3322 | ||
3325 | /* | 3323 | /* |
@@ -3329,7 +3327,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans, | |||
3329 | struct btrfs_root *root, struct btrfs_path *path, | 3327 | struct btrfs_root *root, struct btrfs_path *path, |
3330 | u32 data_size) | 3328 | u32 data_size) |
3331 | { | 3329 | { |
3332 | int ret = 0; | ||
3333 | int slot; | 3330 | int slot; |
3334 | struct extent_buffer *leaf; | 3331 | struct extent_buffer *leaf; |
3335 | struct btrfs_item *item; | 3332 | struct btrfs_item *item; |
@@ -3394,12 +3391,11 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans, | |||
3394 | btrfs_set_item_size(leaf, item, old_size + data_size); | 3391 | btrfs_set_item_size(leaf, item, old_size + data_size); |
3395 | btrfs_mark_buffer_dirty(leaf); | 3392 | btrfs_mark_buffer_dirty(leaf); |
3396 | 3393 | ||
3397 | ret = 0; | ||
3398 | if (btrfs_leaf_free_space(root, leaf) < 0) { | 3394 | if (btrfs_leaf_free_space(root, leaf) < 0) { |
3399 | btrfs_print_leaf(root, leaf); | 3395 | btrfs_print_leaf(root, leaf); |
3400 | BUG(); | 3396 | BUG(); |
3401 | } | 3397 | } |
3402 | return ret; | 3398 | return 0; |
3403 | } | 3399 | } |
3404 | 3400 | ||
3405 | /* | 3401 | /* |
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index dec93485d539..dd421c48c353 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c | |||
@@ -50,7 +50,6 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle | |||
50 | if (di) | 50 | if (di) |
51 | return ERR_PTR(-EEXIST); | 51 | return ERR_PTR(-EEXIST); |
52 | ret = btrfs_extend_item(trans, root, path, data_size); | 52 | ret = btrfs_extend_item(trans, root, path, data_size); |
53 | WARN_ON(ret > 0); | ||
54 | } | 53 | } |
55 | if (ret < 0) | 54 | if (ret < 0) |
56 | return ERR_PTR(ret); | 55 | return ERR_PTR(ret); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 9f5fdd37451d..103e141afeb3 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -947,7 +947,6 @@ static int convert_extent_item_v0(struct btrfs_trans_handle *trans, | |||
947 | BUG_ON(ret); | 947 | BUG_ON(ret); |
948 | 948 | ||
949 | ret = btrfs_extend_item(trans, root, path, new_size); | 949 | ret = btrfs_extend_item(trans, root, path, new_size); |
950 | BUG_ON(ret); | ||
951 | 950 | ||
952 | leaf = path->nodes[0]; | 951 | leaf = path->nodes[0]; |
953 | item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); | 952 | item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); |
@@ -1555,7 +1554,6 @@ int setup_inline_extent_backref(struct btrfs_trans_handle *trans, | |||
1555 | size = btrfs_extent_inline_ref_size(type); | 1554 | size = btrfs_extent_inline_ref_size(type); |
1556 | 1555 | ||
1557 | ret = btrfs_extend_item(trans, root, path, size); | 1556 | ret = btrfs_extend_item(trans, root, path, size); |
1558 | BUG_ON(ret); | ||
1559 | 1557 | ||
1560 | ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); | 1558 | ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); |
1561 | refs = btrfs_extent_refs(leaf, ei); | 1559 | refs = btrfs_extent_refs(leaf, ei); |
@@ -1684,7 +1682,6 @@ int update_inline_extent_backref(struct btrfs_trans_handle *trans, | |||
1684 | end - ptr - size); | 1682 | end - ptr - size); |
1685 | item_size -= size; | 1683 | item_size -= size; |
1686 | ret = btrfs_truncate_item(trans, root, path, item_size, 1); | 1684 | ret = btrfs_truncate_item(trans, root, path, item_size, 1); |
1687 | BUG_ON(ret); | ||
1688 | } | 1685 | } |
1689 | btrfs_mark_buffer_dirty(leaf); | 1686 | btrfs_mark_buffer_dirty(leaf); |
1690 | return 0; | 1687 | return 0; |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 6e7556aa02e8..fb9b02667e75 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -495,7 +495,6 @@ static noinline int truncate_one_csum(struct btrfs_trans_handle *trans, | |||
495 | u32 new_size = (bytenr - key->offset) >> blocksize_bits; | 495 | u32 new_size = (bytenr - key->offset) >> blocksize_bits; |
496 | new_size *= csum_size; | 496 | new_size *= csum_size; |
497 | ret = btrfs_truncate_item(trans, root, path, new_size, 1); | 497 | ret = btrfs_truncate_item(trans, root, path, new_size, 1); |
498 | BUG_ON(ret); | ||
499 | } else if (key->offset >= bytenr && csum_end > end_byte && | 498 | } else if (key->offset >= bytenr && csum_end > end_byte && |
500 | end_byte > key->offset) { | 499 | end_byte > key->offset) { |
501 | /* | 500 | /* |
@@ -508,7 +507,6 @@ static noinline int truncate_one_csum(struct btrfs_trans_handle *trans, | |||
508 | new_size *= csum_size; | 507 | new_size *= csum_size; |
509 | 508 | ||
510 | ret = btrfs_truncate_item(trans, root, path, new_size, 0); | 509 | ret = btrfs_truncate_item(trans, root, path, new_size, 0); |
511 | BUG_ON(ret); | ||
512 | 510 | ||
513 | key->offset = end_byte; | 511 | key->offset = end_byte; |
514 | ret = btrfs_set_item_key_safe(trans, root, path, key); | 512 | ret = btrfs_set_item_key_safe(trans, root, path, key); |
@@ -763,7 +761,6 @@ again: | |||
763 | goto insert; | 761 | goto insert; |
764 | 762 | ||
765 | ret = btrfs_extend_item(trans, root, path, diff); | 763 | ret = btrfs_extend_item(trans, root, path, diff); |
766 | BUG_ON(ret); | ||
767 | goto csum; | 764 | goto csum; |
768 | } | 765 | } |
769 | 766 | ||
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index 64f1150bb48d..baa74f3db691 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c | |||
@@ -130,7 +130,6 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, | |||
130 | item_size - (ptr + sub_item_len - item_start)); | 130 | item_size - (ptr + sub_item_len - item_start)); |
131 | ret = btrfs_truncate_item(trans, root, path, | 131 | ret = btrfs_truncate_item(trans, root, path, |
132 | item_size - sub_item_len, 1); | 132 | item_size - sub_item_len, 1); |
133 | BUG_ON(ret); | ||
134 | out: | 133 | out: |
135 | btrfs_free_path(path); | 134 | btrfs_free_path(path); |
136 | return ret; | 135 | return ret; |
@@ -167,7 +166,6 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, | |||
167 | 166 | ||
168 | old_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]); | 167 | old_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]); |
169 | ret = btrfs_extend_item(trans, root, path, ins_len); | 168 | ret = btrfs_extend_item(trans, root, path, ins_len); |
170 | BUG_ON(ret); | ||
171 | ref = btrfs_item_ptr(path->nodes[0], path->slots[0], | 169 | ref = btrfs_item_ptr(path->nodes[0], path->slots[0], |
172 | struct btrfs_inode_ref); | 170 | struct btrfs_inode_ref); |
173 | ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size); | 171 | ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 72650ceb9829..e9e2b4778279 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3428,7 +3428,6 @@ search_again: | |||
3428 | btrfs_file_extent_calc_inline_size(size); | 3428 | btrfs_file_extent_calc_inline_size(size); |
3429 | ret = btrfs_truncate_item(trans, root, path, | 3429 | ret = btrfs_truncate_item(trans, root, path, |
3430 | size, 1); | 3430 | size, 1); |
3431 | BUG_ON(ret); | ||
3432 | } else if (root->ref_cows) { | 3431 | } else if (root->ref_cows) { |
3433 | inode_sub_bytes(inode, item_end + 1 - | 3432 | inode_sub_bytes(inode, item_end + 1 - |
3434 | found_key.offset); | 3433 | found_key.offset); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index cf2baeb70462..0350147106d5 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -382,7 +382,6 @@ insert: | |||
382 | } else if (found_size < item_size) { | 382 | } else if (found_size < item_size) { |
383 | ret = btrfs_extend_item(trans, root, path, | 383 | ret = btrfs_extend_item(trans, root, path, |
384 | item_size - found_size); | 384 | item_size - found_size); |
385 | BUG_ON(ret); | ||
386 | } | 385 | } |
387 | } else if (ret) { | 386 | } else if (ret) { |
388 | return ret; | 387 | return ret; |