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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>

> ---
>  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)


-- 
Damien Le Moal
Western Digital Research



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux