All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: Arne Jansen <sensille@gmx.net>
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
Date: Fri, 09 Aug 2013 17:57:27 +0800	[thread overview]
Message-ID: <5204BD07.3090206@cn.fujitsu.com> (raw)
In-Reply-To: <5204B974.9030402@gmx.net>

On 08/09/2013 05:42 PM, Arne Jansen wrote:
> 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?

Because other places such as btrfs_qgroup_reserve() will try spin_lock.
and we should relase spin_lock as soon as possible, luckily we are safe
to move btrfs_free_qgroup_config() out of spin_lock.

> 
>>
>> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>>  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.

I will fix typo.

Thank,
Wang
> 
> -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;
> 
> 


  reply	other threads:[~2013-08-09  9:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07  5:12 [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk Wang Shilong
2013-08-07  5:12 ` [PATCH 2/3] Btrfs: move btrfs_free_qgroup_config() out of spin_lock and fix comments Wang Shilong
2013-08-09  9:42   ` Arne Jansen
2013-08-09  9:57     ` Wang Shilong [this message]
2013-08-07  5:12 ` [PATCH 3/3] Btrfs: remove reduplicate check when disabling quota Wang Shilong
2013-08-09  9:36   ` Arne Jansen
2013-08-07  5:16 ` [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk Wang Shilong
2013-08-08 13:20 ` Josef Bacik
2013-08-09  9:12   ` Wang Shilong
2013-08-09  9:30 ` Arne Jansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5204BD07.3090206@cn.fujitsu.com \
    --to=wangsl.fnst@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.com \
    --cc=sensille@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.