Btrfs: use correct key when repeating search for extent item
PATCH 1/1 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.
--- fs/btrfs/extent-tree.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/extent-tree.c +2 -0
@@ -1542,6 +1542,7 @@ again: ret =0 ; }if (ret) { + key.objectid = bytenr; key.type =BTRFS_EXTENT_ITEM_KEY ; key.offset = num_bytes;btrfs_release_path (path);
@@ -5719,6 +5720,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,if (ret >0 && skinny_metadata) { skinny_metadata = false; + key.objectid = bytenr; key.type =BTRFS_EXTENT_ITEM_KEY ; key.offset = num_bytes;btrfs_release_path (path);
Signature · 1 line
1.9.1
PATCH 1/1 Btrfs: correctly set profile flags on seqlock retry
If we had to retry on the profiles seqlock (due to a concurrent write), we would set bits on the input flags that corresponded both to the current profile and to previous values of the profile.
--- fs/btrfs/extent-tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/extent-tree.c +3 -1
@@ -3543,11 +3543,13 @@ static u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags)return extended_to_chunk (flags | tmp); } -static u64 get_alloc_profile (struct btrfs_root *root,u64 flags) +static u64 get_alloc_profile (struct btrfs_root *root,u64 orig_flags) {unsigned seq; +u64 flags; do { + flags = orig_flags; seq = read_seqbegin(&root->fs_info->profiles_lock); if (flags & BTRFS_BLOCK_GROUP_DATA)
Signature · 1 line
1.9.1