Commit ae58954d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: don't handle bio based drivers in blk_revalidate_disk_zones

bio based drivers only need to update q->nr_zones.  Do that manually
instead of overloading blk_revalidate_disk_zones to keep that function
simpler for the next round of changes that will rely even more on the
request based functionality.
Reviewed-by: default avatarJavier González <javier@javigon.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e94f5819
...@@ -419,8 +419,9 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx, ...@@ -419,8 +419,9 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
* *
* Helper function for low-level device drivers to (re) allocate and initialize * Helper function for low-level device drivers to (re) allocate and initialize
* a disk request queue zone bitmaps. This functions should normally be called * a disk request queue zone bitmaps. This functions should normally be called
* within the disk ->revalidate method. For BIO based queues, no zone bitmap * within the disk ->revalidate method for blk-mq based drivers. For BIO based
* is allocated. * drivers only q->nr_zones needs to be updated so that the sysfs exposed value
* is correct.
*/ */
int blk_revalidate_disk_zones(struct gendisk *disk) int blk_revalidate_disk_zones(struct gendisk *disk)
{ {
...@@ -433,15 +434,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk) ...@@ -433,15 +434,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
if (WARN_ON_ONCE(!blk_queue_is_zoned(q))) if (WARN_ON_ONCE(!blk_queue_is_zoned(q)))
return -EIO; return -EIO;
if (WARN_ON_ONCE(!queue_is_mq(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.
*/
if (!queue_is_mq(q)) {
q->nr_zones = args.nr_zones;
return 0;
}
/* /*
* Ensure that all memory allocations in this context are done as * Ensure that all memory allocations in this context are done as
......
...@@ -1576,11 +1576,17 @@ static int null_gendisk_register(struct nullb *nullb) ...@@ -1576,11 +1576,17 @@ static int null_gendisk_register(struct nullb *nullb)
disk->queue = nullb->q; disk->queue = nullb->q;
strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
#ifdef CONFIG_BLK_DEV_ZONED
if (nullb->dev->zoned) { if (nullb->dev->zoned) {
ret = blk_revalidate_disk_zones(disk); if (queue_is_mq(nullb->q)) {
if (ret) ret = blk_revalidate_disk_zones(disk);
return ret; if (ret)
return ret;
} else {
nullb->q->nr_zones = blkdev_nr_zones(disk);
}
} }
#endif
add_disk(disk); add_disk(disk);
return 0; return 0;
......
...@@ -1954,12 +1954,14 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, ...@@ -1954,12 +1954,14 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
/* /*
* For a zoned target, the number of zones should be updated for the * For a zoned target, the number of zones should be updated for the
* correct value to be exposed in sysfs queue/nr_zones. For a BIO based * correct value to be exposed in sysfs queue/nr_zones. For a BIO based
* target, this is all that is needed. For a request based target, the * target, this is all that is needed.
* queue zone bitmaps must also be updated.
* Use blk_revalidate_disk_zones() to handle this.
*/ */
if (blk_queue_is_zoned(q)) #ifdef CONFIG_BLK_DEV_ZONED
blk_revalidate_disk_zones(t->md->disk); if (blk_queue_is_zoned(q)) {
WARN_ON_ONCE(queue_is_mq(q));
q->nr_zones = blkdev_nr_zones(t->md->disk);
}
#endif
/* Allow reads to exceed readahead limits */ /* Allow reads to exceed readahead limits */
q->backing_dev_info->io_pages = limits->max_sectors >> (PAGE_SHIFT - 9); q->backing_dev_info->io_pages = limits->max_sectors >> (PAGE_SHIFT - 9);
......
...@@ -375,11 +375,6 @@ static inline unsigned int blkdev_nr_zones(struct gendisk *disk) ...@@ -375,11 +375,6 @@ static inline unsigned int blkdev_nr_zones(struct gendisk *disk)
return 0; return 0;
} }
static inline int blk_revalidate_disk_zones(struct gendisk *disk)
{
return 0;
}
static inline int blkdev_report_zones_ioctl(struct block_device *bdev, static inline int blkdev_report_zones_ioctl(struct block_device *bdev,
fmode_t mode, unsigned int cmd, fmode_t mode, unsigned int cmd,
unsigned long arg) unsigned long arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment