Thread (86 messages) 86 messages, 7 authors, 2021-01-15

Re: [PATCH v11 05/40] btrfs: release path before calling into btrfs_load_block_group_zone_info

From: Josef Bacik <josef@toxicpanda.com>
Date: 2021-01-11 20:02:34
Also in: linux-fsdevel

On 12/21/20 10:48 PM, Naohiro Aota wrote:
quoted hunk ↗ jump to hunk
From: Johannes Thumshirn <redacted>

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 <redacted>
---
  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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help