OSDN Git Service

btrfs: Move qgroup rescan on quota enable to btrfs_quota_enable
authorNikolay Borisov <nborisov@suse.com>
Wed, 31 Jan 2018 08:52:04 +0000 (10:52 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Mar 2018 13:09:38 +0000 (15:09 +0200)
commit5d23515be66904fa3b1b5d6bd72d2199cd2447ab
tree5b3788f6fd8f308ed1c4478299e2aa447d3aa50d
parent7ce311d552e473a5176f8bb143fb45de64b8bd81
btrfs: Move qgroup rescan on quota enable to btrfs_quota_enable

Currently btrfs_run_qgroups is doing a bit too much. Not only is it
responsible for synchronizing in-memory state of qgroups to disk but
it also contains code to trigger the initial qgroup rescan when
quota is enabled initially. This condition is detected by checking that
BTRFS_FS_QUOTA_ENABLED is not set and BTRFS_FS_QUOTA_ENABLING is set.
Nothing really requires from the code to be structured (and scattered)
the way it is so let's streamline things. First move the quota rescan
code into btrfs_quota_enable, where its invocation is closer to the
use. This also makes the FS_QUOTA_ENABLING flag redundant so let's
remove it as well.

This has been tested with a full xfstest run with qgroups enabled on
the scratch device of every xfstest and no regressions were observed.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/qgroup.c