Message ID | bd9bfdf69f8a03c17b35e0142e693c4bb08a03bd.1604591048.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Set the lockdep class on eb's at allocation time | expand |
On Thu, Nov 5, 2020 at 3:47 PM Josef Bacik <josef@toxicpanda.com> wrote: > > We do not need to call read_tree_block() here, simply use the > btrfs_read_node_slot helper. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> I couldn't get anymore the lockdep splat I reported before (after applying the whole patchset of course), it used to happen very often with btrfs/033. Looks good, thanks. > --- > fs/btrfs/relocation.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c > index 0e2dd7cf87f6..d327b5b4f1cd 100644 > --- a/fs/btrfs/relocation.c > +++ b/fs/btrfs/relocation.c > @@ -1415,10 +1415,8 @@ static noinline_for_stack > int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, > int *level) > { > - struct btrfs_fs_info *fs_info = root->fs_info; > struct extent_buffer *eb = NULL; > int i; > - u64 bytenr; > u64 ptr_gen = 0; > u64 last_snapshot; > u32 nritems; > @@ -1426,8 +1424,6 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, > last_snapshot = btrfs_root_last_snapshot(&root->root_item); > > for (i = *level; i > 0; i--) { > - struct btrfs_key first_key; > - > eb = path->nodes[i]; > nritems = btrfs_header_nritems(eb); > while (path->slots[i] < nritems) { > @@ -1447,16 +1443,9 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, > return 0; > } > > - bytenr = btrfs_node_blockptr(eb, path->slots[i]); > - btrfs_node_key_to_cpu(eb, &first_key, path->slots[i]); > - eb = read_tree_block(fs_info, bytenr, ptr_gen, i - 1, > - &first_key); > - if (IS_ERR(eb)) { > + eb = btrfs_read_node_slot(eb, path->slots[i]); > + if (IS_ERR(eb)) > return PTR_ERR(eb); > - } else if (!extent_buffer_uptodate(eb)) { > - free_extent_buffer(eb); > - return -EIO; > - } > BUG_ON(btrfs_header_level(eb) != i - 1); > path->nodes[i - 1] = eb; > path->slots[i - 1] = 0; > -- > 2.26.2 >
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0e2dd7cf87f6..d327b5b4f1cd 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1415,10 +1415,8 @@ static noinline_for_stack int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, int *level) { - struct btrfs_fs_info *fs_info = root->fs_info; struct extent_buffer *eb = NULL; int i; - u64 bytenr; u64 ptr_gen = 0; u64 last_snapshot; u32 nritems; @@ -1426,8 +1424,6 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, last_snapshot = btrfs_root_last_snapshot(&root->root_item); for (i = *level; i > 0; i--) { - struct btrfs_key first_key; - eb = path->nodes[i]; nritems = btrfs_header_nritems(eb); while (path->slots[i] < nritems) { @@ -1447,16 +1443,9 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, return 0; } - bytenr = btrfs_node_blockptr(eb, path->slots[i]); - btrfs_node_key_to_cpu(eb, &first_key, path->slots[i]); - eb = read_tree_block(fs_info, bytenr, ptr_gen, i - 1, - &first_key); - if (IS_ERR(eb)) { + eb = btrfs_read_node_slot(eb, path->slots[i]); + if (IS_ERR(eb)) return PTR_ERR(eb); - } else if (!extent_buffer_uptodate(eb)) { - free_extent_buffer(eb); - return -EIO; - } BUG_ON(btrfs_header_level(eb) != i - 1); path->nodes[i - 1] = eb; path->slots[i - 1] = 0;
We do not need to call read_tree_block() here, simply use the btrfs_read_node_slot helper. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/relocation.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)