From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net ([212.227.15.15]:55448 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965323Ab3HIJmO (ORCPT ); Fri, 9 Aug 2013 05:42:14 -0400 Received: from [172.24.1.182] ([192.166.201.94]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MWSwU-1VfHod1Z3y-00XZUb for ; Fri, 09 Aug 2013 11:42:13 +0200 Message-ID: <5204B974.9030402@gmx.net> Date: Fri, 09 Aug 2013 11:42:12 +0200 From: Arne Jansen MIME-Version: 1.0 To: Wang Shilong CC: linux-btrfs@vger.kernel.org, miaox@cn.fujitsu.com Subject: Re: [PATCH 2/3] Btrfs: move btrfs_free_qgroup_config() out of spin_lock and fix comments References: <1375852351-11919-1-git-send-email-wangsl.fnst@cn.fujitsu.com> <1375852351-11919-2-git-send-email-wangsl.fnst@cn.fujitsu.com> In-Reply-To: <1375852351-11919-2-git-send-email-wangsl.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-btrfs-owner@vger.kernel.org List-ID: On 07.08.2013 07:12, Wang Shilong wrote: > 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. Why do you do this? Did the spinlock gave you any trouble? > > Signed-off-by: Wang Shilong > Reviewed-by: Miao Xie > --- > fs/btrfs/qgroup.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c > index 3b103e2..b809616 100644 > --- a/fs/btrfs/qgroup.c > +++ b/fs/btrfs/qgroup.c > @@ -432,8 +432,10 @@ out: > } > > /* > - * 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-treaded paths.And for the third one, we have set You could use the opportunity and correct the typo in 'single-treaded'. Also, there's a space missing after the period. -Arne > + * 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;