aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@gmail.com>2014-04-24 10:15:28 -0400
committerChris Mason <clm@fb.com>2014-04-24 19:43:33 -0400
commit9ce49a0b4ff7f13961d8d106ffae959823d2e758 (patch)
treeb7abb6948560dbe6f21af61bdd62d90be7b3735e
parent1c70d8fb4dfa95bee491816b2a6767b5ca1080e7 (diff)
Btrfs: use correct key when repeating search for extent item
If skinny metadata is enabled and our first tree search fails to find a skinny extent item, we may repeat a tree search for a "fat" extent item (if the previous item in the leaf is not the "fat" extent we're looking for). However we were not setting the new key's objectid to the right value, as we previously used the same key variable to peek at the previous item in the leaf, which has a different objectid. So just set the right objectid to avoid modifying/deleting a wrong item if we repeat the tree search. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/extent-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1306487c82cf..678cb352902c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1542,6 +1542,7 @@ again:
1542 ret = 0; 1542 ret = 0;
1543 } 1543 }
1544 if (ret) { 1544 if (ret) {
1545 key.objectid = bytenr;
1545 key.type = BTRFS_EXTENT_ITEM_KEY; 1546 key.type = BTRFS_EXTENT_ITEM_KEY;
1546 key.offset = num_bytes; 1547 key.offset = num_bytes;
1547 btrfs_release_path(path); 1548 btrfs_release_path(path);
@@ -5719,6 +5720,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
5719 5720
5720 if (ret > 0 && skinny_metadata) { 5721 if (ret > 0 && skinny_metadata) {
5721 skinny_metadata = false; 5722 skinny_metadata = false;
5723 key.objectid = bytenr;
5722 key.type = BTRFS_EXTENT_ITEM_KEY; 5724 key.type = BTRFS_EXTENT_ITEM_KEY;
5723 key.offset = num_bytes; 5725 key.offset = num_bytes;
5724 btrfs_release_path(path); 5726 btrfs_release_path(path);