diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2013-08-13 21:13:37 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:15:46 -0400 |
commit | e685da14af6b31e4b336a110cb1bae1afc268be8 (patch) | |
tree | e367ef4e9e61e5efcbb4a2f106144240bbd448ad /fs/btrfs/qgroup.c | |
parent | 4082bd3d734c41b122a91d2a5aded4b76baa84b2 (diff) |
Btrfs: move btrfs_free_qgroup_config() out of spin_lock and fix comments
btrfs_free_qgroup_config() is not only called by open/close_ctree(),but
also btrfs_disable_quota().And for btrfs_disable_quota(),we have set
'quota_root' to be null before calling btrfs_free_qgroup_config(),so it
is safe to cleanup in-memory structures without lock held.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r-- | fs/btrfs/qgroup.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 57b9805873f7..01eeffe9ae53 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -432,8 +432,10 @@ out: | |||
432 | } | 432 | } |
433 | 433 | ||
434 | /* | 434 | /* |
435 | * This is only called from close_ctree() or open_ctree(), both in single- | 435 | * This is called from close_ctree() or open_ctree() or btrfs_quota_disable(), |
436 | * treaded paths. Clean up the in-memory structures. No locking needed. | 436 | * first two are in single-threaded paths.And for the third one, we have set |
437 | * quota_root to be null with qgroup_lock held before, so it is safe to clean | ||
438 | * up the in-memory structures without qgroup_lock held. | ||
437 | */ | 439 | */ |
438 | void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info) | 440 | void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info) |
439 | { | 441 | { |
@@ -937,9 +939,10 @@ int btrfs_quota_disable(struct btrfs_trans_handle *trans, | |||
937 | fs_info->pending_quota_state = 0; | 939 | fs_info->pending_quota_state = 0; |
938 | quota_root = fs_info->quota_root; | 940 | quota_root = fs_info->quota_root; |
939 | fs_info->quota_root = NULL; | 941 | fs_info->quota_root = NULL; |
940 | btrfs_free_qgroup_config(fs_info); | ||
941 | spin_unlock(&fs_info->qgroup_lock); | 942 | spin_unlock(&fs_info->qgroup_lock); |
942 | 943 | ||
944 | btrfs_free_qgroup_config(fs_info); | ||
945 | |||
943 | if (!quota_root) { | 946 | if (!quota_root) { |
944 | ret = -EINVAL; | 947 | ret = -EINVAL; |
945 | goto out; | 948 | goto out; |