public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: zoned: use alloc_list instead of rcu locked device_list
Date: Tue, 15 Mar 2022 20:03:09 +0800	[thread overview]
Message-ID: <73de021b-15ff-01e6-ce2e-be17299cf1ee@oracle.com> (raw)
In-Reply-To: <20220314185539.GM12643@twin.jikos.cz>

On 15/03/2022 02:55, David Sterba wrote:
> On Mon, Mar 14, 2022 at 07:16:47AM -0700, Johannes Thumshirn wrote:
>> Anand pointed out, that instead of using the rcu locked version of
>> fs_devices->device_list we cab use fs_devices->alloc_list, prrotected by
>> the chunk_mutex to traverse the list of active deviices in
>> btrfs_can_activate_zone().
> 
> Why?

We are in the chunk allocation thread. The newer chunk allocation
happens from the devices in the fs_device->alloc_list protected by
the chunk_mutex.

  btrfs_create_chunk()
    lockdep_assert_held(&info->chunk_mutex);
    gather_device_info
     list_for_each_entry(device, &fs_devices->alloc_list, dev_alloc_list) {

Also, a device reappeared after the mount won't join the alloc_list yet
and, it will be in the dev_list, which we don't want to consider in the
context of the chunk alloc.

Thanks, Anand

  reply	other threads:[~2022-03-15 12:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 14:16 [PATCH] btrfs: zoned: use alloc_list instead of rcu locked device_list Johannes Thumshirn
2022-03-14 18:55 ` David Sterba
2022-03-15 12:03   ` Anand Jain [this message]
2022-03-15 20:03 ` David Sterba
2022-03-16  8:36   ` Anand Jain
2022-03-16  8:39     ` Johannes Thumshirn
2022-03-16  8:44       ` Anand Jain

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=73de021b-15ff-01e6-ce2e-be17299cf1ee@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox