From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2] block: RCU protect disk->conv_zones_bitmap
Date: Thu, 7 Nov 2024 14:44:16 +0900 [thread overview]
Message-ID: <ba5cecfc-2f99-49c3-97bf-2ca0364f570a@kernel.org> (raw)
In-Reply-To: <20241107054028.GA2135@lst.de>
On 11/7/24 14:40, Christoph Hellwig wrote:
> As sparse rcu warnings got in my radar for something else, I did
> run sparse over this and it complains. It will need the little
> gem below to fix (and a rebase of the second patch). Otherwise the
> series looks great and way better than my initial hack, thanks!
OK. I will integrate this and send v2.
>
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 7a7855555d6d..bf4458b11720 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -350,11 +350,12 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, blk_mode_t mode,
>
> static inline bool disk_zone_is_conv(struct gendisk *disk, sector_t sector)
> {
> + unsigned long *bitmap;
> bool is_conv;
>
> rcu_read_lock();
> - is_conv = disk->conv_zones_bitmap &&
> - test_bit(disk_zone_no(disk, sector), disk->conv_zones_bitmap);
> + bitmap = rcu_dereference(disk->conv_zones_bitmap);
> + is_conv = bitmap && test_bit(disk_zone_no(disk, sector), bitmap);
> rcu_read_unlock();
>
> return is_conv;
> @@ -1467,11 +1468,10 @@ static unsigned int disk_set_conv_zones_bitmap(struct gendisk *disk,
> unsigned long flags;
>
> spin_lock_irqsave(&disk->zone_wplugs_lock, flags);
> + if (bitmap)
> + nr_conv_zones = bitmap_weight(bitmap, disk->nr_zones);
> bitmap = rcu_replace_pointer(disk->conv_zones_bitmap, bitmap,
> lockdep_is_held(&disk->zone_wplugs_lock));
> - if (disk->conv_zones_bitmap)
> - nr_conv_zones = bitmap_weight(disk->conv_zones_bitmap,
> - disk->nr_zones);
> spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);
>
> kfree_rcu_mightsleep(bitmap);
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-11-07 5:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 23:13 [PATCH 0/2] Introduce bdev_zone_is_seq() Damien Le Moal
2024-11-06 23:13 ` [PATCH 1/2] block: RCU protect disk->conv_zones_bitmap Damien Le Moal
2024-11-06 23:20 ` Bart Van Assche
2024-11-06 23:44 ` Damien Le Moal
2024-11-07 0:02 ` Jens Axboe
2024-11-07 0:14 ` Damien Le Moal
2024-11-07 5:40 ` Christoph Hellwig
2024-11-07 5:44 ` Damien Le Moal [this message]
2024-11-06 23:13 ` [PATCH 2/2] block: Add a public bdev_zone_is_seq() helper Damien Le Moal
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=ba5cecfc-2f99-49c3-97bf-2ca0364f570a@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@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 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.