On 12/21/20 10:48 PM, Naohiro Aota wrote:
From: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
Since we have no write pointer in conventional zones, we cannot determine
allocation offset from it. Instead, we set the allocation offset after the
highest addressed extent. This is done by reading the extent tree in
btrfs_load_block_group_zone_info(). However, this function is called from
btrfs_read_block_groups(), so the read lock for the tree node can
recursively taken.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
---
fs/btrfs/block-group.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index b8bbdd95743e..69e1b24bbbad 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1839,6 +1839,7 @@ static int read_one_block_group(struct btrfs_fs_info *info,
return -ENOMEM;
read_block_group_item(cache, path, key);
+ btrfs_release_path(path);
set_free_space_tree_thresholds(cache);
@@ -2009,7 +2010,6 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
goto error;
key.objectid += key.offset;
key.offset = 0;
- btrfs_release_path(path);
}
btrfs_release_path(path);
Instead why don't we just read in the bgi into the stack, and pass the pointer
into read_one_block_group(), drop the path before calling read_one_block_group?
We don't use the path in read_one_block_group, there's no reason to pass it
in. It'll fix your problem and make it a little cleaner. Thanks,
Josef