scsi: sd_zbc: Rename sd_zbc_check_zones()
Now that the block layer implement zone checks on revalidate, sd_zbc_check_zones() is reduced getting the zone size and verifying the device capacity for device with RC_BASIS=0. Be clear about this by renaming sd_zbc_check_zones() to sd_zbc_check_capacity() and updating the function description and comments. Link: https://lore.kernel.org/r/20191220075823.400072-3-damien.lemoal@wdc.com Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
19aaa40723
commit
dbfc5626d9
|
@ -325,19 +325,21 @@ static int sd_zbc_check_zoned_characteristics(struct scsi_disk *sdkp,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sd_zbc_check_zones - Check the device capacity and zone size
|
* sd_zbc_check_capacity - Check the device capacity
|
||||||
* @sdkp: Target disk
|
* @sdkp: Target disk
|
||||||
|
* @buf: command buffer
|
||||||
|
* @zblock: zone size in number of blocks
|
||||||
*
|
*
|
||||||
* Check that the device capacity as reported by READ CAPACITY matches the
|
* Get the device zone size and check that the device capacity as reported
|
||||||
* max_lba value (plus one)of the report zones command reply.
|
* by READ CAPACITY matches the max_lba value (plus one) of the report zones
|
||||||
|
* command reply for devices with RC_BASIS == 0.
|
||||||
*
|
*
|
||||||
* Returns the zone size in number of blocks upon success or an error code
|
* Returns 0 upon success or an error code upon failure.
|
||||||
* upon failure.
|
|
||||||
*/
|
*/
|
||||||
static int sd_zbc_check_zones(struct scsi_disk *sdkp, unsigned char *buf,
|
static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf,
|
||||||
u32 *zblocks)
|
u32 *zblocks)
|
||||||
{
|
{
|
||||||
u64 zone_blocks = 0;
|
u64 zone_blocks;
|
||||||
sector_t max_lba;
|
sector_t max_lba;
|
||||||
unsigned char *rec;
|
unsigned char *rec;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -360,7 +362,7 @@ static int sd_zbc_check_zones(struct scsi_disk *sdkp, unsigned char *buf,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse REPORT ZONES header */
|
/* Get the size of the first reported zone */
|
||||||
rec = buf + 64;
|
rec = buf + 64;
|
||||||
zone_blocks = get_unaligned_be64(&rec[8]);
|
zone_blocks = get_unaligned_be64(&rec[8]);
|
||||||
if (logical_to_sectors(sdkp->device, zone_blocks) > UINT_MAX) {
|
if (logical_to_sectors(sdkp->device, zone_blocks) > UINT_MAX) {
|
||||||
|
@ -394,11 +396,8 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/*
|
/* Check the device capacity reported by report zones */
|
||||||
* Check zone size: only devices with a constant zone size (except
|
ret = sd_zbc_check_capacity(sdkp, buf, &zone_blocks);
|
||||||
* an eventual last runt zone) that is a power of 2 are supported.
|
|
||||||
*/
|
|
||||||
ret = sd_zbc_check_zones(sdkp, buf, &zone_blocks);
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue