]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: simplify loop in select_reloc_root()
authorJosef Bacik <josef@toxicpanda.com>
Thu, 3 Oct 2024 15:43:06 +0000 (11:43 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:15 +0000 (14:53 +0100)
commit551d04a32a9e0b498c44e545ec27ed4553c59305
treed1d625f2368a34cb2ee0f3c9b4aeabbf9551668e
parentcb7de8ee9c50d86c7ea0f48c6bf50bab84613f22
btrfs: simplify loop in select_reloc_root()

We have this setup as a loop, but in reality we will never walk back up
the backref tree, if we do then it's a bug.  Get rid of the loop and
handle the case where we have node->new_bytenr set at all.  Previous
check was only if node->new_bytenr != root->node->start, but if it did
then we would hit the WARN_ON() and walk back up the tree.

Instead we want to just return error if ->new_bytenr is set, and then do
the normal updating of the node for the reloc root and carry on.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c