]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: reloc: reorder reservation before root selection
authorJosef Bacik <josef@toxicpanda.com>
Fri, 13 Mar 2020 21:17:06 +0000 (17:17 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:03:50 +0000 (17:03 +0100)
commit8f542fbe19ff9368092acd79240103850d4f437d
treeb2d361bfe41e65f76ec23ac386dc5838ac94ab47
parentdd60dd7613f41f9978e031eebde5aaf9f90f0796
btrfs: reloc: reorder reservation before root selection

Since we're not only checking for metadata reservations but also if we
need to throttle our delayed ref generation, reorder
reserve_metadata_space() above the select_one_root() call in
relocate_tree_block().

The reason we want this is because select_reloc_root() will mess with
the backref cache, and if we're going to bail we want to be able to
cleanly remove this node from the backref cache and come back along to
regenerate it.  Move it up so this is the first thing we do to make
restarting cleaner.

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