diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2011-05-19 03:03:42 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-23 13:24:39 -0400 |
commit | b0b802d7e34b0b4a78f911c3a8aad88aa91fd7ab (patch) | |
tree | a921d73b19363e2f29c20265716f8f281fc3f87c /fs/btrfs | |
parent | 27160b6b5a1744b6eaa8416e2b901ec937b1eee0 (diff) |
Btrfs: return error code to caller when btrfs_previous_item fails
The error code is returned instead of calling BUG_ON when
btrfs_previous_item returns the error.
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/volumes.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c7367ae5a3e6..e40cdd5b4669 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -949,14 +949,14 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans, | |||
949 | if (ret > 0) { | 949 | if (ret > 0) { |
950 | ret = btrfs_previous_item(root, path, key.objectid, | 950 | ret = btrfs_previous_item(root, path, key.objectid, |
951 | BTRFS_DEV_EXTENT_KEY); | 951 | BTRFS_DEV_EXTENT_KEY); |
952 | BUG_ON(ret); | 952 | if (ret) |
953 | goto out; | ||
953 | leaf = path->nodes[0]; | 954 | leaf = path->nodes[0]; |
954 | btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); | 955 | btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); |
955 | extent = btrfs_item_ptr(leaf, path->slots[0], | 956 | extent = btrfs_item_ptr(leaf, path->slots[0], |
956 | struct btrfs_dev_extent); | 957 | struct btrfs_dev_extent); |
957 | BUG_ON(found_key.offset > start || found_key.offset + | 958 | BUG_ON(found_key.offset > start || found_key.offset + |
958 | btrfs_dev_extent_length(leaf, extent) < start); | 959 | btrfs_dev_extent_length(leaf, extent) < start); |
959 | ret = 0; | ||
960 | } else if (ret == 0) { | 960 | } else if (ret == 0) { |
961 | leaf = path->nodes[0]; | 961 | leaf = path->nodes[0]; |
962 | extent = btrfs_item_ptr(leaf, path->slots[0], | 962 | extent = btrfs_item_ptr(leaf, path->slots[0], |
@@ -969,6 +969,7 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans, | |||
969 | ret = btrfs_del_item(trans, root, path); | 969 | ret = btrfs_del_item(trans, root, path); |
970 | BUG_ON(ret); | 970 | BUG_ON(ret); |
971 | 971 | ||
972 | out: | ||
972 | btrfs_free_path(path); | 973 | btrfs_free_path(path); |
973 | return ret; | 974 | return ret; |
974 | } | 975 | } |