Skip to content

Commit

Permalink
block: cleanup the !zoned case in blk_revalidate_disk_zones
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Nov 13, 2019
1 parent d9dd730 commit c98c3d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions block/blk-zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
sector_t sector = 0;
int ret = 0;

if (WARN_ON_ONCE(!blk_queue_is_zoned(q)))
return -EIO;

/*
* BIO based queues do not use a scheduler so only q->nr_zones
* needs to be updated so that the sysfs exposed value is correct.
Expand All @@ -535,10 +538,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
*/
noio_flag = memalloc_noio_save();

if (!blk_queue_is_zoned(q) || !nr_zones) {
nr_zones = 0;
if (!nr_zones)
goto update;
}

/* Allocate bitmaps */
ret = -ENOMEM;
Expand Down

0 comments on commit c98c3d0

Please sign in to comment.