Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e685da14 authored by Wang Shilong's avatar Wang Shilong Committed by Chris Mason
Browse files

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: default avatarWang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 4082bd3d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -432,8 +432,10 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
}

/*
 * This is only called from close_ctree() or open_ctree(), both in single-
 * treaded paths. Clean up the in-memory structures. No locking needed.
 * This is called from close_ctree() or open_ctree() or btrfs_quota_disable(),
 * first two are in single-threaded paths.And for the third one, we have set
 * quota_root to be null with qgroup_lock held before, so it is safe to clean
 * up the in-memory structures without qgroup_lock held.
 */
void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info)
{
@@ -937,9 +939,10 @@ int btrfs_quota_disable(struct btrfs_trans_handle *trans,
	fs_info->pending_quota_state = 0;
	quota_root = fs_info->quota_root;
	fs_info->quota_root = NULL;
	btrfs_free_qgroup_config(fs_info);
	spin_unlock(&fs_info->qgroup_lock);

	btrfs_free_qgroup_config(fs_info);

	if (!quota_root) {
		ret = -EINVAL;
		goto out;