diff mbox series

[2/8] scsi: sd_zbc: Rename a local variable

Message ID 20220415201752.2793700-3-bvanassche@acm.org
State New
Headers show
Series Support zoned devices with gap zones | expand

Commit Message

Bart Van Assche April 15, 2022, 8:17 p.m. UTC
For zoned storage the word 'capacity' can either refer to the device
capacity or to the zone capacity. Prevent confusion between these two
concepts by renaming 'capacity' into 'device_capacity'.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/sd_zbc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Damien Le Moal April 17, 2022, 11:08 p.m. UTC | #1
On 4/16/22 05:17, Bart Van Assche wrote:
> For zoned storage the word 'capacity' can either refer to the device
> capacity or to the zone capacity. Prevent confusion between these two
> concepts by renaming 'capacity' into 'device_capacity'.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Looks good.

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

> ---
>  drivers/scsi/sd_zbc.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index 925976ac5113..d0275855b16c 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -223,7 +223,8 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
>  			unsigned int nr_zones, report_zones_cb cb, void *data)
>  {
>  	struct scsi_disk *sdkp = scsi_disk(disk);
> -	sector_t capacity = logical_to_sectors(sdkp->device, sdkp->capacity);
> +	sector_t device_capacity = logical_to_sectors(sdkp->device,
> +						      sdkp->capacity);
>  	unsigned int nr, i;
>  	unsigned char *buf;
>  	size_t offset, buflen = 0;
> @@ -234,7 +235,7 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
>  		/* Not a zoned device */
>  		return -EOPNOTSUPP;
>  
> -	if (!capacity)
> +	if (!device_capacity)
>  		/* Device gone or invalid */
>  		return -ENODEV;
>  
> @@ -242,7 +243,7 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
>  	if (!buf)
>  		return -ENOMEM;
>  
> -	while (zone_idx < nr_zones && sector < capacity) {
> +	while (zone_idx < nr_zones && sector < device_capacity) {
>  		ret = sd_zbc_do_report_zones(sdkp, buf, buflen,
>  				sectors_to_logical(sdkp->device, sector), true);
>  		if (ret)
diff mbox series

Patch

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 925976ac5113..d0275855b16c 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -223,7 +223,8 @@  int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
 			unsigned int nr_zones, report_zones_cb cb, void *data)
 {
 	struct scsi_disk *sdkp = scsi_disk(disk);
-	sector_t capacity = logical_to_sectors(sdkp->device, sdkp->capacity);
+	sector_t device_capacity = logical_to_sectors(sdkp->device,
+						      sdkp->capacity);
 	unsigned int nr, i;
 	unsigned char *buf;
 	size_t offset, buflen = 0;
@@ -234,7 +235,7 @@  int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
 		/* Not a zoned device */
 		return -EOPNOTSUPP;
 
-	if (!capacity)
+	if (!device_capacity)
 		/* Device gone or invalid */
 		return -ENODEV;
 
@@ -242,7 +243,7 @@  int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
 	if (!buf)
 		return -ENOMEM;
 
-	while (zone_idx < nr_zones && sector < capacity) {
+	while (zone_idx < nr_zones && sector < device_capacity) {
 		ret = sd_zbc_do_report_zones(sdkp, buf, buflen,
 				sectors_to_logical(sdkp->device, sector), true);
 		if (ret)