diff mbox series

[13/16] nvmet:: use bdev based helpers in nvmet_bdev_zone_mgmt_emulate_all

Message ID 20220706070350.1703384-14-hch@lst.de (mailing list archive)
State Not Applicable
Headers show
Series [01/16] block: remove a superflous ifdef in blkdev.h | expand

Commit Message

Christoph Hellwig July 6, 2022, 7:03 a.m. UTC
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: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/target/zns.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Damien Le Moal July 6, 2022, 11:59 a.m. UTC | #1
On 7/6/22 16:03, Christoph Hellwig wrote:
> 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: Christoph Hellwig <hch@lst.de>

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

> ---
>  drivers/nvme/target/zns.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
> index c4c99b832daf2..9d8717126ab31 100644
> --- a/drivers/nvme/target/zns.c
> +++ b/drivers/nvme/target/zns.c
> @@ -413,7 +413,7 @@ static u16 nvmet_bdev_zone_mgmt_emulate_all(struct nvmet_req *req)
>  		ret = 0;
>  	}
>  
> -	while (sector < get_capacity(bdev->bd_disk)) {
> +	while (sector < bdev_nr_sectors(bdev)) {
>  		if (test_bit(blk_queue_zone_no(q, sector), d.zbitmap)) {
>  			bio = blk_next_bio(bio, bdev, 0,
>  				zsa_req_op(req->cmd->zms.zsa) | REQ_SYNC,
> @@ -422,7 +422,7 @@ static u16 nvmet_bdev_zone_mgmt_emulate_all(struct nvmet_req *req)
>  			/* This may take a while, so be nice to others */
>  			cond_resched();
>  		}
> -		sector += blk_queue_zone_sectors(q);
> +		sector += bdev_zone_sectors(bdev);
>  	}
>  
>  	if (bio) {
diff mbox series

Patch

diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
index c4c99b832daf2..9d8717126ab31 100644
--- a/drivers/nvme/target/zns.c
+++ b/drivers/nvme/target/zns.c
@@ -413,7 +413,7 @@  static u16 nvmet_bdev_zone_mgmt_emulate_all(struct nvmet_req *req)
 		ret = 0;
 	}
 
-	while (sector < get_capacity(bdev->bd_disk)) {
+	while (sector < bdev_nr_sectors(bdev)) {
 		if (test_bit(blk_queue_zone_no(q, sector), d.zbitmap)) {
 			bio = blk_next_bio(bio, bdev, 0,
 				zsa_req_op(req->cmd->zms.zsa) | REQ_SYNC,
@@ -422,7 +422,7 @@  static u16 nvmet_bdev_zone_mgmt_emulate_all(struct nvmet_req *req)
 			/* This may take a while, so be nice to others */
 			cond_resched();
 		}
-		sector += blk_queue_zone_sectors(q);
+		sector += bdev_zone_sectors(bdev);
 	}
 
 	if (bio) {