Skip to content

Commit c98c3d0

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: cleanup the !zoned case in blk_revalidate_disk_zones
blk_revalidate_disk_zones is never called for non-zoned devices. Just return early and warn instead of trying to handle this case. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d9dd730 commit c98c3d0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎block/blk-zoned.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
520520
sector_t sector = 0;
521521
int ret = 0;
522522

523+
if (WARN_ON_ONCE(!blk_queue_is_zoned(q)))
524+
return -EIO;
525+
523526
/*
524527
* BIO based queues do not use a scheduler so only q->nr_zones
525528
* needs to be updated so that the sysfs exposed value is correct.
@@ -535,10 +538,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
535538
*/
536539
noio_flag = memalloc_noio_save();
537540

538-
if (!blk_queue_is_zoned(q) || !nr_zones) {
539-
nr_zones = 0;
541+
if (!nr_zones)
540542
goto update;
541-
}
542543

543544
/* Allocate bitmaps */
544545
ret = -ENOMEM;

0 commit comments

Comments
 (0)