Re: [PATCH v3 3/3] scsi: Set allocation length to 255 for ATA Information VPD page

From: Damien Le Moal
Date: Thu Jan 06 2022 - 00:21:37 EST


On 1/6/22 13:13, Martin K. Petersen wrote:
>
> Maciej,
>
>> Oh, you'll also need a follow-on patch that uses the cached ATA
>> Information VPD page. I'll try to get my full series out today.
>
> I would really appreciate it if you would be willing give this a whirl:
>
> https://git.kernel.org/mkp/h/5.18/discovery

Martin,

Indeed, my bad.

That said, it is weird that scsi_get_vpd_page() does not call
scsi_device_supports_vpd(). We could simplify everything like this:

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index f6af1562cba4..c27eabedf9e3 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -341,7 +341,7 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8
page, unsigned char *buf,
{
int i, result;

- if (sdev->skip_vpd_pages)
+ if (!scsi_device_supports_vpd(sdev))
goto fail;

/* Ask for all the pages supported by this device */
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 65875a598d62..2ef7953512ed 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3316,12 +3316,10 @@ static int sd_revalidate_disk(struct gendisk *disk)
blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);

- if (scsi_device_supports_vpd(sdp)) {
- sd_read_block_provisioning(sdkp);
- sd_read_block_limits(sdkp);
- sd_read_block_characteristics(sdkp);
- sd_zbc_read_zones(sdkp, buffer);
- }
+ sd_read_block_provisioning(sdkp);
+ sd_read_block_limits(sdkp);
+ sd_read_block_characteristics(sdkp);
+ sd_zbc_read_zones(sdkp, buffer);

sd_print_capacity(sdkp, old_capacity);

Since all the sd_read_xxx() functions do nothing if the vpd page needed
is not supported.


--
Damien Le Moal
Western Digital Research