This is the 5.10.207 stable release
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmWhmYAACgkQONu9yGCS aT55Jg//bf6BqwllQ461VVRWWIgAJ36NmcoVM1q44ZVsjbxC3suCRJ0TCZ6TnHEP 9c6q1dRTXyaYnlUNlxrMiKHA7FEBuZqjh+2suSbAcRiLcn/D6HArCUO0Pldr0too OgPQCNbyq9nQF8ipcUowVUNsgiJIdB+FS7mPDoP7mKEHrd0vkt0GY0egHLfqY4OG hkEyg3uzzwWuwH+4ex2YA562VXmaP+p60jUoC4SPvmhyGEVH3R7IU1nq+25FZkm3 Mzcu+t/I0GFMlGsDjXTC5lyPOLJD3yV7JRYqeJ+eYSTx2YiH27RIvijVJEuLP76d WYgLsHCc3TfVLv811CstaH9RR8n1inCRV2ZwsgVvRaGyUbXL4Hn1/ulcCZlH1E8+ Kl/1+aCR697Vvl4UEHxEb4Wgu+lQL58Yeh8frxDHHXxz7Etx2eHpGuxJzH1FB0r/ KgwnDIj7dfPAlT9X5o6ImqwF9Rrj5p8djuZ12BEKCgVP1NNXgbcOV5w5eWDcAMIw dfGCXM7VITv/J4mNbQ2Xs3HQKK2j1+0xZlQMW3qZvsOdG42b42edmnKtjBXNu4wS nsS3zY9J3u5fSrCnd0nQCIxE3o0wzwVpBmsfGNL5Pa21mSjWanWEgxZrP44Hgh7/ L94LC//wE+YQOxS9F4ZzHvBM/chp/zZA3nd3jzOTXIvplwQziug= =TnKy -----END PGP SIGNATURE----- Merge 5.10.207 into android12-5.10-lts Changes in 5.10.207 Revert "scsi: core: Always send batch on reset or error handling command" Revert "scsi: core: Use a structure member to track the SCSI command submitter" Revert "scsi: core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request" Revert "scsi: core: Make scsi_get_lba() return the LBA" Revert "scsi: core: Introduce scsi_get_sector()" Revert "scsi: core: Add scsi_prot_ref_tag() helper" scsi: core: Always send batch on reset or error handling command Linux 5.10.207 Change-Id: I82d93fd6487ae259092c38e9943fadfa3320e807 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
commit
c925f18af7
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
VERSION = 5
|
VERSION = 5
|
||||||
PATCHLEVEL = 10
|
PATCHLEVEL = 10
|
||||||
SUBLEVEL = 206
|
SUBLEVEL = 207
|
||||||
EXTRAVERSION =
|
EXTRAVERSION =
|
||||||
NAME = Dare mighty things
|
NAME = Dare mighty things
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
|
|||||||
"(result %x)\n", cmd->result));
|
"(result %x)\n", cmd->result));
|
||||||
|
|
||||||
good_bytes = scsi_bufflen(cmd);
|
good_bytes = scsi_bufflen(cmd);
|
||||||
if (!blk_rq_is_passthrough(scsi_cmd_to_rq(cmd))) {
|
if (!blk_rq_is_passthrough(cmd->request)) {
|
||||||
int old_good_bytes = good_bytes;
|
int old_good_bytes = good_bytes;
|
||||||
drv = scsi_cmd_to_driver(cmd);
|
drv = scsi_cmd_to_driver(cmd);
|
||||||
if (drv->done)
|
if (drv->done)
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
|
static void scsi_eh_done(struct scsi_cmnd *scmd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These should *probably* be handled by the host itself.
|
* These should *probably* be handled by the host itself.
|
||||||
* Since it is allowed to sleep, it probably should.
|
* Since it is allowed to sleep, it probably should.
|
||||||
@ -228,7 +230,7 @@ scsi_abort_command(struct scsi_cmnd *scmd)
|
|||||||
*/
|
*/
|
||||||
static void scsi_eh_reset(struct scsi_cmnd *scmd)
|
static void scsi_eh_reset(struct scsi_cmnd *scmd)
|
||||||
{
|
{
|
||||||
if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) {
|
if (!blk_rq_is_passthrough(scmd->request)) {
|
||||||
struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
|
struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
|
||||||
if (sdrv->eh_reset)
|
if (sdrv->eh_reset)
|
||||||
sdrv->eh_reset(scmd);
|
sdrv->eh_reset(scmd);
|
||||||
@ -498,8 +500,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
|
|||||||
/* handler does not care. Drop down to default handling */
|
/* handler does not care. Drop down to default handling */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scmd->cmnd[0] == TEST_UNIT_READY &&
|
if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done)
|
||||||
scmd->submitter != SUBMITTED_BY_SCSI_ERROR_HANDLER)
|
|
||||||
/*
|
/*
|
||||||
* nasty: for mid-layer issued TURs, we need to return the
|
* nasty: for mid-layer issued TURs, we need to return the
|
||||||
* actual sense data without any recovery attempt. For eh
|
* actual sense data without any recovery attempt. For eh
|
||||||
@ -767,7 +768,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
|
|||||||
* scsi_eh_done - Completion function for error handling.
|
* scsi_eh_done - Completion function for error handling.
|
||||||
* @scmd: Cmd that is done.
|
* @scmd: Cmd that is done.
|
||||||
*/
|
*/
|
||||||
void scsi_eh_done(struct scsi_cmnd *scmd)
|
static void scsi_eh_done(struct scsi_cmnd *scmd)
|
||||||
{
|
{
|
||||||
struct completion *eh_action;
|
struct completion *eh_action;
|
||||||
|
|
||||||
@ -1067,7 +1068,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
|
|||||||
shost->eh_action = &done;
|
shost->eh_action = &done;
|
||||||
|
|
||||||
scsi_log_send(scmd);
|
scsi_log_send(scmd);
|
||||||
scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER;
|
scmd->scsi_done = scsi_eh_done;
|
||||||
scmd->flags |= SCMD_LAST;
|
scmd->flags |= SCMD_LAST;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1095,7 +1096,6 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
|
|||||||
if (rtn) {
|
if (rtn) {
|
||||||
if (timeleft > stall_for) {
|
if (timeleft > stall_for) {
|
||||||
scsi_eh_restore_cmnd(scmd, &ses);
|
scsi_eh_restore_cmnd(scmd, &ses);
|
||||||
|
|
||||||
timeleft -= stall_for;
|
timeleft -= stall_for;
|
||||||
msleep(jiffies_to_msecs(stall_for));
|
msleep(jiffies_to_msecs(stall_for));
|
||||||
goto retry;
|
goto retry;
|
||||||
@ -1168,7 +1168,7 @@ static int scsi_request_sense(struct scsi_cmnd *scmd)
|
|||||||
|
|
||||||
static int scsi_eh_action(struct scsi_cmnd *scmd, int rtn)
|
static int scsi_eh_action(struct scsi_cmnd *scmd, int rtn)
|
||||||
{
|
{
|
||||||
if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) {
|
if (!blk_rq_is_passthrough(scmd->request)) {
|
||||||
struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
|
struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
|
||||||
if (sdrv->eh_action)
|
if (sdrv->eh_action)
|
||||||
rtn = sdrv->eh_action(scmd, rtn);
|
rtn = sdrv->eh_action(scmd, rtn);
|
||||||
@ -1734,24 +1734,22 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q,
|
|||||||
*/
|
*/
|
||||||
int scsi_noretry_cmd(struct scsi_cmnd *scmd)
|
int scsi_noretry_cmd(struct scsi_cmnd *scmd)
|
||||||
{
|
{
|
||||||
struct request *req = scsi_cmd_to_rq(scmd);
|
|
||||||
|
|
||||||
switch (host_byte(scmd->result)) {
|
switch (host_byte(scmd->result)) {
|
||||||
case DID_OK:
|
case DID_OK:
|
||||||
break;
|
break;
|
||||||
case DID_TIME_OUT:
|
case DID_TIME_OUT:
|
||||||
goto check_type;
|
goto check_type;
|
||||||
case DID_BUS_BUSY:
|
case DID_BUS_BUSY:
|
||||||
return req->cmd_flags & REQ_FAILFAST_TRANSPORT;
|
return (scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT);
|
||||||
case DID_PARITY:
|
case DID_PARITY:
|
||||||
return req->cmd_flags & REQ_FAILFAST_DEV;
|
return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
|
||||||
case DID_ERROR:
|
case DID_ERROR:
|
||||||
if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
|
if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
|
||||||
status_byte(scmd->result) == RESERVATION_CONFLICT)
|
status_byte(scmd->result) == RESERVATION_CONFLICT)
|
||||||
return 0;
|
return 0;
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case DID_SOFT_ERROR:
|
case DID_SOFT_ERROR:
|
||||||
return req->cmd_flags & REQ_FAILFAST_DRIVER;
|
return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status_byte(scmd->result) != CHECK_CONDITION)
|
if (status_byte(scmd->result) != CHECK_CONDITION)
|
||||||
@ -1762,7 +1760,8 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
|
|||||||
* assume caller has checked sense and determined
|
* assume caller has checked sense and determined
|
||||||
* the check condition was retryable.
|
* the check condition was retryable.
|
||||||
*/
|
*/
|
||||||
if (req->cmd_flags & REQ_FAILFAST_DEV || blk_rq_is_passthrough(req))
|
if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
|
||||||
|
blk_rq_is_passthrough(scmd->request))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2323,6 +2322,11 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(scsi_report_device_reset);
|
EXPORT_SYMBOL(scsi_report_device_reset);
|
||||||
|
|
||||||
|
static void
|
||||||
|
scsi_reset_provider_done_command(struct scsi_cmnd *scmd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scsi_ioctl_reset: explicitly reset a host/bus/target/device
|
* scsi_ioctl_reset: explicitly reset a host/bus/target/device
|
||||||
* @dev: scsi_device to operate on
|
* @dev: scsi_device to operate on
|
||||||
@ -2358,9 +2362,9 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
|
|||||||
scsi_init_command(dev, scmd);
|
scsi_init_command(dev, scmd);
|
||||||
scmd->request = rq;
|
scmd->request = rq;
|
||||||
scmd->cmnd = scsi_req(rq)->cmd;
|
scmd->cmnd = scsi_req(rq)->cmd;
|
||||||
|
|
||||||
scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL;
|
|
||||||
scmd->flags |= SCMD_LAST;
|
scmd->flags |= SCMD_LAST;
|
||||||
|
|
||||||
|
scmd->scsi_done = scsi_reset_provider_done_command;
|
||||||
memset(&scmd->sdb, 0, sizeof(scmd->sdb));
|
memset(&scmd->sdb, 0, sizeof(scmd->sdb));
|
||||||
|
|
||||||
scmd->cmd_len = 0;
|
scmd->cmd_len = 0;
|
||||||
|
@ -153,15 +153,13 @@ scsi_set_blocked(struct scsi_cmnd *cmd, int reason)
|
|||||||
|
|
||||||
static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)
|
static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
struct request *rq = scsi_cmd_to_rq(cmd);
|
if (cmd->request->rq_flags & RQF_DONTPREP) {
|
||||||
|
cmd->request->rq_flags &= ~RQF_DONTPREP;
|
||||||
if (rq->rq_flags & RQF_DONTPREP) {
|
|
||||||
rq->rq_flags &= ~RQF_DONTPREP;
|
|
||||||
scsi_mq_uninit_cmd(cmd);
|
scsi_mq_uninit_cmd(cmd);
|
||||||
} else {
|
} else {
|
||||||
WARN_ON_ONCE(true);
|
WARN_ON_ONCE(true);
|
||||||
}
|
}
|
||||||
blk_mq_requeue_request(rq, true);
|
blk_mq_requeue_request(cmd->request, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,7 +198,7 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, bool unbusy)
|
|||||||
*/
|
*/
|
||||||
cmd->result = 0;
|
cmd->result = 0;
|
||||||
|
|
||||||
blk_mq_requeue_request(scsi_cmd_to_rq(cmd), true);
|
blk_mq_requeue_request(cmd->request, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -510,7 +508,7 @@ void scsi_run_host_queues(struct Scsi_Host *shost)
|
|||||||
|
|
||||||
static void scsi_uninit_cmd(struct scsi_cmnd *cmd)
|
static void scsi_uninit_cmd(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
if (!blk_rq_is_passthrough(scsi_cmd_to_rq(cmd))) {
|
if (!blk_rq_is_passthrough(cmd->request)) {
|
||||||
struct scsi_driver *drv = scsi_cmd_to_driver(cmd);
|
struct scsi_driver *drv = scsi_cmd_to_driver(cmd);
|
||||||
|
|
||||||
if (drv->uninit_command)
|
if (drv->uninit_command)
|
||||||
@ -660,7 +658,7 @@ static void scsi_io_completion_reprep(struct scsi_cmnd *cmd,
|
|||||||
|
|
||||||
static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd)
|
static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
struct request *req = scsi_cmd_to_rq(cmd);
|
struct request *req = cmd->request;
|
||||||
unsigned long wait_for;
|
unsigned long wait_for;
|
||||||
|
|
||||||
if (cmd->allowed == SCSI_CMD_RETRIES_NO_LIMIT)
|
if (cmd->allowed == SCSI_CMD_RETRIES_NO_LIMIT)
|
||||||
@ -679,7 +677,7 @@ static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd)
|
|||||||
static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
|
static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
|
||||||
{
|
{
|
||||||
struct request_queue *q = cmd->device->request_queue;
|
struct request_queue *q = cmd->device->request_queue;
|
||||||
struct request *req = scsi_cmd_to_rq(cmd);
|
struct request *req = cmd->request;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,
|
enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,
|
||||||
ACTION_DELAYED_RETRY} action;
|
ACTION_DELAYED_RETRY} action;
|
||||||
@ -851,7 +849,7 @@ static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result,
|
|||||||
{
|
{
|
||||||
bool sense_valid;
|
bool sense_valid;
|
||||||
bool sense_current = true; /* false implies "deferred sense" */
|
bool sense_current = true; /* false implies "deferred sense" */
|
||||||
struct request *req = scsi_cmd_to_rq(cmd);
|
struct request *req = cmd->request;
|
||||||
struct scsi_sense_hdr sshdr;
|
struct scsi_sense_hdr sshdr;
|
||||||
|
|
||||||
sense_valid = scsi_command_normalize_sense(cmd, &sshdr);
|
sense_valid = scsi_command_normalize_sense(cmd, &sshdr);
|
||||||
@ -940,7 +938,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
|
|||||||
{
|
{
|
||||||
int result = cmd->result;
|
int result = cmd->result;
|
||||||
struct request_queue *q = cmd->device->request_queue;
|
struct request_queue *q = cmd->device->request_queue;
|
||||||
struct request *req = scsi_cmd_to_rq(cmd);
|
struct request *req = cmd->request;
|
||||||
blk_status_t blk_stat = BLK_STS_OK;
|
blk_status_t blk_stat = BLK_STS_OK;
|
||||||
|
|
||||||
if (unlikely(result)) /* a nz result may or may not be an error */
|
if (unlikely(result)) /* a nz result may or may not be an error */
|
||||||
@ -1008,7 +1006,7 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev,
|
|||||||
blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd)
|
blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
struct scsi_device *sdev = cmd->device;
|
struct scsi_device *sdev = cmd->device;
|
||||||
struct request *rq = scsi_cmd_to_rq(cmd);
|
struct request *rq = cmd->request;
|
||||||
unsigned short nr_segs = blk_rq_nr_phys_segments(rq);
|
unsigned short nr_segs = blk_rq_nr_phys_segments(rq);
|
||||||
struct scatterlist *last_sg = NULL;
|
struct scatterlist *last_sg = NULL;
|
||||||
blk_status_t ret;
|
blk_status_t ret;
|
||||||
@ -1137,7 +1135,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
|
|||||||
{
|
{
|
||||||
void *buf = cmd->sense_buffer;
|
void *buf = cmd->sense_buffer;
|
||||||
void *prot = cmd->prot_sdb;
|
void *prot = cmd->prot_sdb;
|
||||||
struct request *rq = scsi_cmd_to_rq(cmd);
|
struct request *rq = blk_mq_rq_from_pdu(cmd);
|
||||||
unsigned int flags = cmd->flags & SCMD_PRESERVED_FLAGS;
|
unsigned int flags = cmd->flags & SCMD_PRESERVED_FLAGS;
|
||||||
unsigned long jiffies_at_alloc;
|
unsigned long jiffies_at_alloc;
|
||||||
int retries, to_clear;
|
int retries, to_clear;
|
||||||
@ -1596,21 +1594,12 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
|
|||||||
|
|
||||||
static void scsi_mq_done(struct scsi_cmnd *cmd)
|
static void scsi_mq_done(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
switch (cmd->submitter) {
|
if (unlikely(blk_should_fake_timeout(cmd->request->q)))
|
||||||
case SUBMITTED_BY_BLOCK_LAYER:
|
|
||||||
break;
|
|
||||||
case SUBMITTED_BY_SCSI_ERROR_HANDLER:
|
|
||||||
return scsi_eh_done(cmd);
|
|
||||||
case SUBMITTED_BY_SCSI_RESET_IOCTL:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(blk_should_fake_timeout(scsi_cmd_to_rq(cmd)->q)))
|
|
||||||
return;
|
return;
|
||||||
if (unlikely(test_and_set_bit(SCMD_STATE_COMPLETE, &cmd->state)))
|
if (unlikely(test_and_set_bit(SCMD_STATE_COMPLETE, &cmd->state)))
|
||||||
return;
|
return;
|
||||||
trace_scsi_dispatch_cmd_done(cmd);
|
trace_scsi_dispatch_cmd_done(cmd);
|
||||||
blk_mq_complete_request(scsi_cmd_to_rq(cmd));
|
blk_mq_complete_request(cmd->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scsi_mq_put_budget(struct request_queue *q)
|
static void scsi_mq_put_budget(struct request_queue *q)
|
||||||
@ -1694,7 +1683,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|||||||
|
|
||||||
scsi_set_resid(cmd, 0);
|
scsi_set_resid(cmd, 0);
|
||||||
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
|
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
|
||||||
cmd->submitter = SUBMITTED_BY_BLOCK_LAYER;
|
|
||||||
cmd->scsi_done = scsi_mq_done;
|
cmd->scsi_done = scsi_mq_done;
|
||||||
|
|
||||||
blk_mq_start_request(req);
|
blk_mq_start_request(req);
|
||||||
|
@ -28,9 +28,8 @@ static void scsi_log_release_buffer(char *bufptr)
|
|||||||
|
|
||||||
static inline const char *scmd_name(const struct scsi_cmnd *scmd)
|
static inline const char *scmd_name(const struct scsi_cmnd *scmd)
|
||||||
{
|
{
|
||||||
struct request *rq = scsi_cmd_to_rq((struct scsi_cmnd *)scmd);
|
return scmd->request->rq_disk ?
|
||||||
|
scmd->request->rq_disk->disk_name : NULL;
|
||||||
return rq->rq_disk ? rq->rq_disk->disk_name : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t sdev_format_header(char *logbuf, size_t logbuf_len,
|
static size_t sdev_format_header(char *logbuf, size_t logbuf_len,
|
||||||
@ -92,7 +91,7 @@ void scmd_printk(const char *level, const struct scsi_cmnd *scmd,
|
|||||||
if (!logbuf)
|
if (!logbuf)
|
||||||
return;
|
return;
|
||||||
off = sdev_format_header(logbuf, logbuf_len, scmd_name(scmd),
|
off = sdev_format_header(logbuf, logbuf_len, scmd_name(scmd),
|
||||||
scsi_cmd_to_rq((struct scsi_cmnd *)scmd)->tag);
|
scmd->request->tag);
|
||||||
if (off < logbuf_len) {
|
if (off < logbuf_len) {
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
|
off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
|
||||||
@ -189,7 +188,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
off = sdev_format_header(logbuf, logbuf_len,
|
off = sdev_format_header(logbuf, logbuf_len,
|
||||||
scmd_name(cmd), scsi_cmd_to_rq(cmd)->tag);
|
scmd_name(cmd), cmd->request->tag);
|
||||||
if (off >= logbuf_len)
|
if (off >= logbuf_len)
|
||||||
goto out_printk;
|
goto out_printk;
|
||||||
off += scnprintf(logbuf + off, logbuf_len - off, "CDB: ");
|
off += scnprintf(logbuf + off, logbuf_len - off, "CDB: ");
|
||||||
@ -211,7 +210,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
|
|||||||
|
|
||||||
off = sdev_format_header(logbuf, logbuf_len,
|
off = sdev_format_header(logbuf, logbuf_len,
|
||||||
scmd_name(cmd),
|
scmd_name(cmd),
|
||||||
scsi_cmd_to_rq(cmd)->tag);
|
cmd->request->tag);
|
||||||
if (!WARN_ON(off > logbuf_len - 58)) {
|
if (!WARN_ON(off > logbuf_len - 58)) {
|
||||||
off += scnprintf(logbuf + off, logbuf_len - off,
|
off += scnprintf(logbuf + off, logbuf_len - off,
|
||||||
"CDB[%02x]: ", k);
|
"CDB[%02x]: ", k);
|
||||||
@ -374,8 +373,7 @@ EXPORT_SYMBOL(__scsi_print_sense);
|
|||||||
/* Normalize and print sense buffer in SCSI command */
|
/* Normalize and print sense buffer in SCSI command */
|
||||||
void scsi_print_sense(const struct scsi_cmnd *cmd)
|
void scsi_print_sense(const struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
scsi_log_print_sense(cmd->device, scmd_name(cmd),
|
scsi_log_print_sense(cmd->device, scmd_name(cmd), cmd->request->tag,
|
||||||
scsi_cmd_to_rq((struct scsi_cmnd *)cmd)->tag,
|
|
||||||
cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
|
cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(scsi_print_sense);
|
EXPORT_SYMBOL(scsi_print_sense);
|
||||||
@ -394,8 +392,8 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
|
|||||||
if (!logbuf)
|
if (!logbuf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
off = sdev_format_header(logbuf, logbuf_len, scmd_name(cmd),
|
off = sdev_format_header(logbuf, logbuf_len,
|
||||||
scsi_cmd_to_rq((struct scsi_cmnd *)cmd)->tag);
|
scmd_name(cmd), cmd->request->tag);
|
||||||
|
|
||||||
if (off >= logbuf_len)
|
if (off >= logbuf_len)
|
||||||
goto out_printk;
|
goto out_printk;
|
||||||
|
@ -82,7 +82,6 @@ void scsi_eh_ready_devs(struct Scsi_Host *shost,
|
|||||||
int scsi_eh_get_sense(struct list_head *work_q,
|
int scsi_eh_get_sense(struct list_head *work_q,
|
||||||
struct list_head *done_q);
|
struct list_head *done_q);
|
||||||
int scsi_noretry_cmd(struct scsi_cmnd *scmd);
|
int scsi_noretry_cmd(struct scsi_cmnd *scmd);
|
||||||
void scsi_eh_done(struct scsi_cmnd *scmd);
|
|
||||||
|
|
||||||
/* scsi_lib.c */
|
/* scsi_lib.c */
|
||||||
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
|
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
|
||||||
|
@ -66,12 +66,6 @@ struct scsi_pointer {
|
|||||||
#define SCMD_STATE_COMPLETE 0
|
#define SCMD_STATE_COMPLETE 0
|
||||||
#define SCMD_STATE_INFLIGHT 1
|
#define SCMD_STATE_INFLIGHT 1
|
||||||
|
|
||||||
enum scsi_cmnd_submitter {
|
|
||||||
SUBMITTED_BY_BLOCK_LAYER = 0,
|
|
||||||
SUBMITTED_BY_SCSI_ERROR_HANDLER = 1,
|
|
||||||
SUBMITTED_BY_SCSI_RESET_IOCTL = 2,
|
|
||||||
} __packed;
|
|
||||||
|
|
||||||
struct scsi_cmnd {
|
struct scsi_cmnd {
|
||||||
struct scsi_request req;
|
struct scsi_request req;
|
||||||
struct scsi_device *device;
|
struct scsi_device *device;
|
||||||
@ -95,7 +89,6 @@ struct scsi_cmnd {
|
|||||||
unsigned char prot_op;
|
unsigned char prot_op;
|
||||||
unsigned char prot_type;
|
unsigned char prot_type;
|
||||||
unsigned char prot_flags;
|
unsigned char prot_flags;
|
||||||
enum scsi_cmnd_submitter submitter;
|
|
||||||
|
|
||||||
unsigned short cmd_len;
|
unsigned short cmd_len;
|
||||||
enum dma_data_direction sc_data_direction;
|
enum dma_data_direction sc_data_direction;
|
||||||
@ -175,9 +168,7 @@ static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
|
|||||||
/* make sure not to use it with passthrough commands */
|
/* make sure not to use it with passthrough commands */
|
||||||
static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
|
static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
struct request *rq = scsi_cmd_to_rq(cmd);
|
return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
|
||||||
|
|
||||||
return *(struct scsi_driver **)rq->rq_disk->private_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void scsi_finish_command(struct scsi_cmnd *cmd);
|
extern void scsi_finish_command(struct scsi_cmnd *cmd);
|
||||||
@ -239,18 +230,6 @@ static inline int scsi_sg_copy_to_buffer(struct scsi_cmnd *cmd,
|
|||||||
buf, buflen);
|
buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline sector_t scsi_get_sector(struct scsi_cmnd *scmd)
|
|
||||||
{
|
|
||||||
return blk_rq_pos(scsi_cmd_to_rq(scmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
|
|
||||||
{
|
|
||||||
unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
|
|
||||||
|
|
||||||
return blk_rq_pos(scsi_cmd_to_rq(scmd)) >> shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The operations below are hints that tell the controller driver how
|
* The operations below are hints that tell the controller driver how
|
||||||
* to handle I/Os with DIF or similar types of protection information.
|
* to handle I/Os with DIF or similar types of protection information.
|
||||||
@ -313,11 +292,9 @@ static inline unsigned char scsi_get_prot_type(struct scsi_cmnd *scmd)
|
|||||||
return scmd->prot_type;
|
return scmd->prot_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
|
static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
|
||||||
{
|
{
|
||||||
struct request *rq = blk_mq_rq_from_pdu(scmd);
|
return blk_rq_pos(scmd->request);
|
||||||
|
|
||||||
return t10_pi_ref_tag(rq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
|
static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
|
||||||
|
@ -271,15 +271,13 @@ sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
|
|||||||
__printf(3, 4) void
|
__printf(3, 4) void
|
||||||
scmd_printk(const char *, const struct scsi_cmnd *, const char *, ...);
|
scmd_printk(const char *, const struct scsi_cmnd *, const char *, ...);
|
||||||
|
|
||||||
#define scmd_dbg(scmd, fmt, a...) \
|
#define scmd_dbg(scmd, fmt, a...) \
|
||||||
do { \
|
do { \
|
||||||
struct request *__rq = scsi_cmd_to_rq((scmd)); \
|
if ((scmd)->request->rq_disk) \
|
||||||
\
|
sdev_dbg((scmd)->device, "[%s] " fmt, \
|
||||||
if (__rq->rq_disk) \
|
(scmd)->request->rq_disk->disk_name, ##a);\
|
||||||
sdev_dbg((scmd)->device, "[%s] " fmt, \
|
else \
|
||||||
__rq->rq_disk->disk_name, ##a); \
|
sdev_dbg((scmd)->device, fmt, ##a); \
|
||||||
else \
|
|
||||||
sdev_dbg((scmd)->device, fmt, ##a); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
enum scsi_target_state {
|
enum scsi_target_state {
|
||||||
|
Loading…
Reference in New Issue
Block a user