Commit 375c140c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: use bdev based helpers in blkdev_zone_mgmt{,all}

Use the bdev based helpers instead of the queue based ones to clean up
the code a bit and prepare for storing all zone related fields in
struct gendisk.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20220706070350.1703384-13-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b623e347
...@@ -190,8 +190,8 @@ static int blkdev_zone_reset_all_emulated(struct block_device *bdev, ...@@ -190,8 +190,8 @@ static int blkdev_zone_reset_all_emulated(struct block_device *bdev,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
struct request_queue *q = bdev_get_queue(bdev); struct request_queue *q = bdev_get_queue(bdev);
sector_t capacity = get_capacity(bdev->bd_disk); sector_t capacity = bdev_nr_sectors(bdev);
sector_t zone_sectors = blk_queue_zone_sectors(q); sector_t zone_sectors = bdev_zone_sectors(bdev);
unsigned long *need_reset; unsigned long *need_reset;
struct bio *bio = NULL; struct bio *bio = NULL;
sector_t sector = 0; sector_t sector = 0;
...@@ -262,8 +262,8 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, ...@@ -262,8 +262,8 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
struct request_queue *q = bdev_get_queue(bdev); struct request_queue *q = bdev_get_queue(bdev);
sector_t zone_sectors = blk_queue_zone_sectors(q); sector_t zone_sectors = bdev_zone_sectors(bdev);
sector_t capacity = get_capacity(bdev->bd_disk); sector_t capacity = bdev_nr_sectors(bdev);
sector_t end_sector = sector + nr_sectors; sector_t end_sector = sector + nr_sectors;
struct bio *bio = NULL; struct bio *bio = NULL;
int ret = 0; int ret = 0;
......
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