btrfs: let btrfs_delete_unused_bgs() to clean relocated bgs
authorNaohiro Aota <naohiro.aota@hgst.com>
Fri, 2 Sep 2016 07:46:32 +0000 (16:46 +0900)
committerDavid Sterba <dsterba@suse.com>
Tue, 6 Sep 2016 16:36:19 +0000 (18:36 +0200)
commitff682817dd98e4b575074615d1ae7ced4abca738
tree0e91bd3649fa1f22f7af2a271ba3be977756b287
parenta4a563129e8d4e132e22f87d74db7b0f0376da93
btrfs: let btrfs_delete_unused_bgs() to clean relocated bgs

Currently, btrfs_relocate_chunk() is removing relocated BG by itself. But
the work can be done by btrfs_delete_unused_bgs() (and it's better since it
trim the BG). Let's dedupe the code.

While btrfs_delete_unused_bgs() is already hitting the relocated BG, it
skip the BG since the BG has "ro" flag set (to keep balancing BG intact).
On the other hand, btrfs cannot drop "ro" flag here to prevent additional
writes. So this patch make use of "removed" flag.
btrfs_delete_unused_bgs() now detect the flag to distinguish whether a
read-only BG is relocating or not.

Signed-off-by: Naohiro Aota <naohiro.aota@hgst.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/volumes.c
This page took 0.024785 seconds and 5 git commands to generate.