From: Josef Bacik <jbacik@fb.com>
To: <miaox@cn.fujitsu.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: don't take the chunk_mutex/dev_list mutex in statfs V2
Date: Thu, 6 Nov 2014 09:35:17 -0500 [thread overview]
Message-ID: <545B8725.40909@fb.com> (raw)
In-Reply-To: <5458A9F1.1070901@cn.fujitsu.com>
On 11/04/2014 05:26 AM, Miao Xie wrote:
> On Mon, 3 Nov 2014 08:56:50 -0500, Josef Bacik wrote:
>> Our gluster boxes get several thousand statfs() calls per second, which begins
>> to suck hardcore with all of the lock contention on the chunk mutex and dev list
>> mutex. We don't really need to hold these things, if we have transient
>> weirdness with statfs() because of the chunk allocator we don't care, so remove
>> this locking.
>>
>> We still need the dev_list lock if you mount with -o alloc_start however, which
>> is a good argument for nuking that thing from orbit, but that's a patch for
>> another day. Thanks,
>>
>> Signed-off-by: Josef Bacik <jbacik@fb.com>
>> ---
>> V1->V2: make sure ->alloc_start is set before doing the dev extent lookup logic.
>
> I am strange that why we need dev_list_lock if we mount with -o alloc_start. AFAIK.
> ->alloc_start is protected by chunk_mutex.
>
> But I think we needn't care that someone changes ->alloc_start, in other words,
> we needn't take chunk_mutex during the whole process, the following case can be
> tolerated by the users, I think.
>
> Task1 Task2
> statfs
> mutex_lock(&fs_info->chunk_mutex);
> tmp = fs_info->alloc_start;
> mutex_unlock(&fs_info->chunk_mutex);
> btrfs_calc_avail_data_space(fs_info, tmp)
> ...
> mount -o remount,alloc_start=xxxx
> ...
Yeah df if you change alloc_start in the middle of it is going to be
slightly racey, which is fine since I'm going to kill alloc_start soon
anyway. Since we have to take the device mutex anyway I guess we could
do this, but I'm not super worried about it. Thanks,
Josef
next prev parent reply other threads:[~2014-11-06 14:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 13:56 [PATCH] Btrfs: don't take the chunk_mutex/dev_list mutex in statfs V2 Josef Bacik
2014-11-04 10:26 ` Miao Xie
2014-11-06 14:35 ` Josef Bacik [this message]
2014-11-14 13:50 ` David Sterba
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=545B8725.40909@fb.com \
--to=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
/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.