Commit 6cb7f0b8 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

btrfs: use level argument in log tree walk callback replay_one_buffer()



We already have the extent buffer's level in an argument, there's no need
to first ensure the extent buffer's data is loaded (by calling
btrfs_read_extent_buffer()) and then call btrfs_header_level() to check
the level. So use the level argument and do the check before calling
btrfs_read_extent_buffer().

Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c2ef817b
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -2591,17 +2591,15 @@ static int replay_one_buffer(struct extent_buffer *eb,
	int i;
	int ret;

	if (level != 0)
		return 0;

	ret = btrfs_read_extent_buffer(eb, &check);
	if (ret) {
		btrfs_abort_transaction(trans, ret);
		return ret;
	}

	level = btrfs_header_level(eb);

	if (level != 0)
		return 0;

	path = btrfs_alloc_path();
	if (!path) {
		btrfs_abort_transaction(trans, -ENOMEM);