]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nullb: use blk_queue_set_zoned() to setup zoned devices
authorDamien Le Moal <damien.lemoal@wdc.com>
Thu, 28 Jan 2021 04:47:28 +0000 (13:47 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Feb 2021 14:44:40 +0000 (07:44 -0700)
Use blk_queue_set_zoned() to set a nullb device zone model instead of
directly assigning the device queue zoned limit. This initialization of
the devicve zoned model as well as the setup of the queue flag
QUEUE_FLAG_ZONE_RESETALL and of the device queue elevator feature are
moved from null_init_zoned_dev() to null_register_zoned_dev() so that
the initialization of the queue limits is done when the gendisk of the
nullb device is available.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@edc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk/zoned.c

index 148b871f263ba91629b52001786074a96fe13a55..78cae8703dcfb22c03985379cdb99b91705af11c 100644 (file)
@@ -146,10 +146,6 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
                sector += dev->zone_size_sects;
        }
 
-       q->limits.zoned = BLK_ZONED_HM;
-       blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
-       blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
-
        return 0;
 }
 
@@ -158,6 +154,10 @@ int null_register_zoned_dev(struct nullb *nullb)
        struct nullb_device *dev = nullb->dev;
        struct request_queue *q = nullb->q;
 
+       blk_queue_set_zoned(nullb->disk, BLK_ZONED_HM);
+       blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
+       blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
+
        if (queue_is_mq(q)) {
                int ret = blk_revalidate_disk_zones(nullb->disk, NULL);