btrfs: explictly delete unused block groups in close_ctree and ro-remount
authorJeff Mahoney <jeffm@suse.com>
Mon, 15 Jun 2015 13:41:18 +0000 (09:41 -0400)
committerChris Mason <clm@fb.com>
Wed, 29 Jul 2015 15:15:27 +0000 (08:15 -0700)
commite44163e177960ee60e32a73bffdd53c3a5827406
treeffc55e93df052f4077f70ca996f2147dbb940237
parent499f377f49f085ee4aa214c738e948e88626f39b
btrfs: explictly delete unused block groups in close_ctree and ro-remount

The cleaner thread may already be sleeping by the time we enter
close_ctree.  If that's the case, we'll skip removing any unused
block groups queued for removal, even during a normal umount.
They'll be cleaned up automatically at next mount, but users
expect a umount to be a clean synchronization point, especially
when used on thin-provisioned storage with -odiscard.  We also
explicitly remove unused block groups in the ro-remount path
for the same reason.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Tested-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/disk-io.c
fs/btrfs/super.c