Skip to content

Commit

Permalink
scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag
Browse files Browse the repository at this point in the history
Prepare for skipping the IO advice hints grouping mode 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: 4f53138 ("scsi: sd: Translate data lifetime information")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/60
  • Loading branch information
bvanassche authored and heftig committed Jun 21, 2024
1 parent 63a6a99 commit f4e8b6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -3125,6 +3126,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);
Expand Down
4 changes: 3 additions & 1 deletion include/scsi/scsi_devinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 query the IO advice hints grouping 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) \
Expand Down

0 comments on commit f4e8b6b

Please sign in to comment.