aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/file-item.c10
-rw-r--r--fs/btrfs/root-tree.c6
-rw-r--r--fs/btrfs/tree-log.c10
-rw-r--r--fs/btrfs/volumes.c4
4 files changed, 19 insertions, 11 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index a6a9d4e8b491..6e7556aa02e8 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -551,10 +551,10 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
551 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 551 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
552 if (ret > 0) { 552 if (ret > 0) {
553 if (path->slots[0] == 0) 553 if (path->slots[0] == 0)
554 goto out; 554 break;
555 path->slots[0]--; 555 path->slots[0]--;
556 } else if (ret < 0) { 556 } else if (ret < 0) {
557 goto out; 557 break;
558 } 558 }
559 559
560 leaf = path->nodes[0]; 560 leaf = path->nodes[0];
@@ -579,7 +579,8 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
579 /* delete the entire item, it is inside our range */ 579 /* delete the entire item, it is inside our range */
580 if (key.offset >= bytenr && csum_end <= end_byte) { 580 if (key.offset >= bytenr && csum_end <= end_byte) {
581 ret = btrfs_del_item(trans, root, path); 581 ret = btrfs_del_item(trans, root, path);
582 BUG_ON(ret); 582 if (ret)
583 goto out;
583 if (key.offset == bytenr) 584 if (key.offset == bytenr)
584 break; 585 break;
585 } else if (key.offset < bytenr && csum_end > end_byte) { 586 } else if (key.offset < bytenr && csum_end > end_byte) {
@@ -633,9 +634,10 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
633 } 634 }
634 btrfs_release_path(root, path); 635 btrfs_release_path(root, path);
635 } 636 }
637 ret = 0;
636out: 638out:
637 btrfs_free_path(path); 639 btrfs_free_path(path);
638 return 0; 640 return ret;
639} 641}
640 642
641int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, 643int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 6928bff62daa..2cf5f5142159 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -385,7 +385,10 @@ again:
385 *sequence = btrfs_root_ref_sequence(leaf, ref); 385 *sequence = btrfs_root_ref_sequence(leaf, ref);
386 386
387 ret = btrfs_del_item(trans, tree_root, path); 387 ret = btrfs_del_item(trans, tree_root, path);
388 BUG_ON(ret); 388 if (ret) {
389 err = ret;
390 goto out;
391 }
389 } else 392 } else
390 err = -ENOENT; 393 err = -ENOENT;
391 394
@@ -397,6 +400,7 @@ again:
397 goto again; 400 goto again;
398 } 401 }
399 402
403out:
400 btrfs_free_path(path); 404 btrfs_free_path(path);
401 return err; 405 return err;
402} 406}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index f997ec0c1ba4..cf2baeb70462 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1050,7 +1050,8 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
1050 break; 1050 break;
1051 1051
1052 ret = btrfs_del_item(trans, root, path); 1052 ret = btrfs_del_item(trans, root, path);
1053 BUG_ON(ret); 1053 if (ret)
1054 goto out;
1054 1055
1055 btrfs_release_path(root, path); 1056 btrfs_release_path(root, path);
1056 inode = read_one_inode(root, key.offset); 1057 inode = read_one_inode(root, key.offset);
@@ -1068,8 +1069,10 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
1068 */ 1069 */
1069 key.offset = (u64)-1; 1070 key.offset = (u64)-1;
1070 } 1071 }
1072 ret = 0;
1073out:
1071 btrfs_release_path(root, path); 1074 btrfs_release_path(root, path);
1072 return 0; 1075 return ret;
1073} 1076}
1074 1077
1075 1078
@@ -2587,7 +2590,8 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans,
2587 break; 2590 break;
2588 2591
2589 ret = btrfs_del_item(trans, log, path); 2592 ret = btrfs_del_item(trans, log, path);
2590 BUG_ON(ret); 2593 if (ret)
2594 break;
2591 btrfs_release_path(log, path); 2595 btrfs_release_path(log, path);
2592 } 2596 }
2593 btrfs_release_path(log, path); 2597 btrfs_release_path(log, path);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e40cdd5b4669..deca1a0326ad 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -967,7 +967,6 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans,
967 if (device->bytes_used > 0) 967 if (device->bytes_used > 0)
968 device->bytes_used -= btrfs_dev_extent_length(leaf, extent); 968 device->bytes_used -= btrfs_dev_extent_length(leaf, extent);
969 ret = btrfs_del_item(trans, root, path); 969 ret = btrfs_del_item(trans, root, path);
970 BUG_ON(ret);
971 970
972out: 971out:
973 btrfs_free_path(path); 972 btrfs_free_path(path);
@@ -1770,10 +1769,9 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
1770 BUG_ON(ret); 1769 BUG_ON(ret);
1771 1770
1772 ret = btrfs_del_item(trans, root, path); 1771 ret = btrfs_del_item(trans, root, path);
1773 BUG_ON(ret);
1774 1772
1775 btrfs_free_path(path); 1773 btrfs_free_path(path);
1776 return 0; 1774 return ret;
1777} 1775}
1778 1776
1779static int btrfs_del_sys_chunk(struct btrfs_root *root, u64 chunk_objectid, u64 1777static int btrfs_del_sys_chunk(struct btrfs_root *root, u64 chunk_objectid, u64