OSDN Git Service

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)
commit5f6b2e5cd67a7bb39eb24fa3206e54803e1a25ff
treeb2d361bfe41e65f76ec23ac386dc5838ac94ab47
parentd7ff00f6082c8578a26d75f2ca1aa28b8f05901e
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