summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-11-11 11:39:23 +0900
committerJens Axboe <axboe@kernel.dk>2019-11-12 19:11:54 -0700
commitc98c3d09fca41323765af0dc7926b150cf29ebff (patch)
tree4c781fcf29fc3af14ba0e76cd02c5d2737d106e8
parentd9dd73087a8b6d78d3bf8411620306f2313cdbae (diff)
downloadlinux-c98c3d09fca41323765af0dc7926b150cf29ebff.tar.bz2
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>
-rw-r--r--block/blk-zoned.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index dae787f67019..523a28d7a15c 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -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.
@@ -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;