diff mbox series

[v2,1/2] scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag

Message ID 20240612203735.4108690-3-bvanassche@acm.org
State Superseded
Headers show
Series Do not read the IO hints VPD page from USB storage devices | expand

Commit Message

Bart Van Assche June 12, 2024, 8:37 p.m. UTC
Prepare for skipping reading the IO hints VPD page for USB storage devices.

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Joao Machado <jocrismachado@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Christian Heusel <christian@heusel.eu>
Cc: stable@vger.kernel.org
Fixes: 4f53138fffc2 ("scsi: sd: Translate data lifetime information")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/sd.c           | 4 ++++
 include/scsi/scsi_devinfo.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen June 13, 2024, 7:40 p.m. UTC | #1
Hi Bart!

> Prepare for skipping reading the IO hints VPD page for USB storage
                                   ^^^^^^^^^^^^^^^^^
[...]
> @@ -3117,6 +3118,9 @@ static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer)
>  	struct scsi_mode_data data;
>  	int res;
>  
> +	if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS)
> +		return;
> +
>  	res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a,
>  			      /*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT,
>  			      sdkp->max_retries, &data, &sshdr);
              ^^^^^^^^^^^^^^^

s/IO hints VPD page/IO Advice Hints Grouping mode page/g

?

PS. I'm not fussy about Cc. But I generally avoid listing anybody who
will be automatically copied by virtue of any *-by: tags.

I tend to use Cc as an indicator that this entity needs to act upon the
patch in question. Ack, review, test, respond to comments, or merge in
case of stable@.

If a person listed in Cc subsequently responds with a tag, their name
may be listed more than once in the commit description. But I view that
as documentation that the person whose feedback was requested actually
responded. That's useful information as far as I'm concerned...
Andy Shevchenko June 13, 2024, 7:47 p.m. UTC | #2
On Thu, Jun 13, 2024 at 9:40 PM Martin K. Petersen
<martin.petersen@oracle.com> wrote:

...

> PS. I'm not fussy about Cc. But I generally avoid listing anybody who
> will be automatically copied by virtue of any *-by: tags.
>
> I tend to use Cc as an indicator that this entity needs to act upon the
> patch in question. Ack, review, test, respond to comments, or merge in
> case of stable@.

And nobody asks to remove them! The only outcome of what I see is
beneficial, i.e. cleaning up the commit message. Everything else will
work as expected, e.g., all listed people will be informed as you want
to.

> If a person listed in Cc subsequently responds with a tag, their name
> may be listed more than once in the commit description. But I view that
> as documentation that the person whose feedback was requested actually
> responded. That's useful information as far as I'm concerned...

Again, feel free to have a duplicate, but please do it after --- line.
diff mbox series

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3a43e2209751..fcf3d7730466 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -63,6 +63,7 @@ 
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_device.h>
+#include <scsi/scsi_devinfo.h>
 #include <scsi/scsi_driver.h>
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_host.h>
@@ -3117,6 +3118,9 @@  static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer)
 	struct scsi_mode_data data;
 	int res;
 
+	if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS)
+		return;
+
 	res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a,
 			      /*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT,
 			      sdkp->max_retries, &data, &sshdr);
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 6b548dc2c496..fa8721e49dec 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -69,8 +69,10 @@ 
 #define BLIST_RETRY_ITF		((__force blist_flags_t)(1ULL << 32))
 /* Always retry ABORTED_COMMAND with ASC 0xc1 */
 #define BLIST_RETRY_ASC_C1	((__force blist_flags_t)(1ULL << 33))
+/* Do not read the I/O hints mode page */
+#define BLIST_SKIP_IO_HINTS	((__force blist_flags_t)(1ULL << 34))
 
-#define __BLIST_LAST_USED BLIST_RETRY_ASC_C1
+#define __BLIST_LAST_USED BLIST_SKIP_IO_HINTS
 
 #define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \
 			       (__force blist_flags_t) \