On 10/30/25 11:13 PM, Damien Le Moal wrote:
zone. This increases the memory usage from 1 bit per zone to 1 bytes per

1 bytes -> 1 byte

+bool bdev_zone_is_seq(struct block_device *bdev, sector_t sector)
+{
+       struct gendisk *disk = bdev->bd_disk;
+       unsigned int zno = disk_zone_no(disk, sector);
+       bool is_seq = false;
+       u8 *zones_cond;
+
+       if (!bdev_is_zoned(bdev))
+               return false;
+
+       rcu_read_lock();
+       zones_cond = rcu_dereference(disk->zones_cond);
+       if (zones_cond)
+               is_seq = zones_cond[zno] != BLK_ZONE_COND_NOT_WP;
+       rcu_read_unlock();
+
+       return is_seq;
+}
+EXPORT_SYMBOL_GPL(bdev_zone_is_seq);

'zno' should be compared to the size of the zones_cond[] array before
using 'zno' as an array index.

  static int disk_revalidate_zone_resources(struct gendisk *disk,
-                                         unsigned int nr_zones)
+                               struct blk_revalidate_zone_args *args)
  {
        struct queue_limits *lim = &disk->queue->limits;
        unsigned int pool_size;
+ args->disk = disk;
+       args->nr_zones =
+               DIV_ROUND_UP_ULL(get_capacity(disk), lim->chunk_sectors);
+
+       /* Cached zone conditions: 1 byte per zone */
+       args->zones_cond = kzalloc(args->nr_zones, GFP_NOIO);
+       if (!args->zones_cond)
+               return -ENOMEM;

Why args->nr_zones as array size instead of args->nr_conv_zones? The
patch description says that this array is only used for conventional
zones.

        /*
         * Some devices can advertize zone resource limits that are larger than

advertize -> advertise

Thanks,

Bart.

Reply via email to