[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2024 21:35:56 +0200
From: David Sterba <dsterba@...e.cz>
To: Johannes Thumshirn <jth@...nel.org>
Cc: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org, Hans Holmberg <Hans.Holmberg@....com>,
Naohiro Aota <Naohiro.Aota@....com>, hch@....de,
Damien LeMoal <dlemoal@...nel.org>, Boris Burkov <boris@....io>,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: Re: [PATCH RFC PATCH 1/3] btrfs: zoned: traverse device list in
should reclaim under rcu_read_lock
Subject: btrfs: zoned: traverse device list in should reclaim under rcu_read_lock
Please use the function name in the subject instead of the description,
so like
btrfs: zoned: traverse device list under RCU lock in btrfs_zoned_should_reclaim()
On Thu, Mar 28, 2024 at 02:56:31PM +0100, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@....com>
>
> As btrfs_zoned_should_reclaim() traverses the device list with the
> device_list_mutex held. But we're never changing the device list. All we
> do is gathering the used and total bytes.
>
> So change the list traversal from the holding the device_list_mutex to
> rcu_read_lock(). This also opens up the possibilities to call
> btrfs_zoned_should_reclaim() with the chunk_mutex held.
You can add this patch independently, the device_list_mutex does not
seem to be needed for strong consistency of the values you read.
There are several other places where devices are under RCU only, like
btrfs_commit_device_sizes (though this is also in the transaction
context), various ioctls and btrfs_calc_avail_data_space().
Powered by blists - more mailing lists