forked from Minki/linux
[PATCH] scsi: remove meaningless scsi_cmnd->serial_number_at_timeout field
scsi_cmnd->serial_number_at_timeout doesn't serve any purpose anymore. All serial_number == serial_number_at_timeout tests are always true in abort callbacks. Kill the field. Also, as ->pid always equals ->serial_number and ->serial_number doesn't have any special meaning anymore, update comments above ->serial_number accordingly. Once we remove all uses of this field from all lldd's, this field should go. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
d3a933dc98
commit
c6295cdf65
@ -2957,13 +2957,6 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
|
|||||||
int TargetID = Command->device->id;
|
int TargetID = Command->device->id;
|
||||||
struct BusLogic_CCB *CCB;
|
struct BusLogic_CCB *CCB;
|
||||||
BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested);
|
BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested);
|
||||||
/*
|
|
||||||
If this Command has already completed, then no Abort is necessary.
|
|
||||||
*/
|
|
||||||
if (Command->serial_number != Command->serial_number_at_timeout) {
|
|
||||||
BusLogic_Warning("Unable to Abort Command to Target %d - " "Already Completed\n", HostAdapter, TargetID);
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
Attempt to find an Active CCB for this Command. If no Active CCB for this
|
Attempt to find an Active CCB for this Command. If no Active CCB for this
|
||||||
Command is found, then no Abort is necessary.
|
Command is found, then no Abort is necessary.
|
||||||
|
@ -9198,9 +9198,8 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s)
|
|||||||
s->use_sg, s->sglist_len, s->abort_reason);
|
s->use_sg, s->sglist_len, s->abort_reason);
|
||||||
|
|
||||||
printk(
|
printk(
|
||||||
" serial_number 0x%x, serial_number_at_timeout 0x%x, retries %d, allowed %d\n",
|
" serial_number 0x%x, retries %d, allowed %d\n",
|
||||||
(unsigned) s->serial_number, (unsigned) s->serial_number_at_timeout,
|
(unsigned) s->serial_number, s->retries, s->allowed);
|
||||||
s->retries, s->allowed);
|
|
||||||
|
|
||||||
printk(
|
printk(
|
||||||
" timeout_per_command %d, timeout_total %d, timeout %d\n",
|
" timeout_per_command %d, timeout_total %d, timeout %d\n",
|
||||||
|
@ -833,13 +833,6 @@ ips_eh_abort(Scsi_Cmnd * SC)
|
|||||||
if (!ha->active)
|
if (!ha->active)
|
||||||
return (FAILED);
|
return (FAILED);
|
||||||
|
|
||||||
if (SC->serial_number != SC->serial_number_at_timeout) {
|
|
||||||
/* HMM, looks like a bogus command */
|
|
||||||
DEBUG(1, "Abort called with bogus scsi command");
|
|
||||||
|
|
||||||
return (FAILED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See if the command is on the copp queue */
|
/* See if the command is on the copp queue */
|
||||||
item = ha->copp_waitlist.head;
|
item = ha->copp_waitlist.head;
|
||||||
while ((item) && (item->scsi_cmd != SC))
|
while ((item) && (item->scsi_cmd != SC))
|
||||||
|
@ -7486,24 +7486,14 @@ static int ncr53c8xx_abort(struct scsi_cmnd *cmd)
|
|||||||
struct scsi_cmnd *done_list;
|
struct scsi_cmnd *done_list;
|
||||||
|
|
||||||
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
|
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
|
||||||
printk("ncr53c8xx_abort: pid=%lu serial_number=%ld serial_number_at_timeout=%ld\n",
|
printk("ncr53c8xx_abort: pid=%lu serial_number=%ld\n",
|
||||||
cmd->pid, cmd->serial_number, cmd->serial_number_at_timeout);
|
cmd->pid, cmd->serial_number);
|
||||||
#else
|
#else
|
||||||
printk("ncr53c8xx_abort: command pid %lu\n", cmd->pid);
|
printk("ncr53c8xx_abort: command pid %lu\n", cmd->pid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NCR_LOCK_NCB(np, flags);
|
NCR_LOCK_NCB(np, flags);
|
||||||
|
|
||||||
#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
|
|
||||||
/*
|
|
||||||
* We have to just ignore abort requests in some situations.
|
|
||||||
*/
|
|
||||||
if (cmd->serial_number != cmd->serial_number_at_timeout) {
|
|
||||||
sts = SCSI_ABORT_NOT_RUNNING;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sts = ncr_abort_command(np, cmd);
|
sts = ncr_abort_command(np, cmd);
|
||||||
out:
|
out:
|
||||||
done_list = np->done_list;
|
done_list = np->done_list;
|
||||||
|
@ -1050,10 +1050,8 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
|
|||||||
for (i = 0; i < cmd->cmd_len; i++) {
|
for (i = 0; i < cmd->cmd_len; i++) {
|
||||||
printk("0x%02x ", cmd->cmnd[i]);
|
printk("0x%02x ", cmd->cmnd[i]);
|
||||||
}
|
}
|
||||||
printk("\n seg_cnt=%d, allowed=%d, retries=%d, "
|
printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
|
||||||
"serial_number_at_timeout=0x%lx\n",
|
cmd->use_sg, cmd->allowed, cmd->retries);
|
||||||
cmd->use_sg, cmd->allowed, cmd->retries,
|
|
||||||
cmd->serial_number_at_timeout);
|
|
||||||
printk(" request buffer=0x%p, request buffer len=0x%x\n",
|
printk(" request buffer=0x%p, request buffer len=0x%x\n",
|
||||||
cmd->request_buffer, cmd->request_bufflen);
|
cmd->request_buffer, cmd->request_bufflen);
|
||||||
printk(" tag=%d, transfersize=0x%x\n",
|
printk(" tag=%d, transfersize=0x%x\n",
|
||||||
|
@ -686,7 +686,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
|
|||||||
cmd->request = sreq->sr_request;
|
cmd->request = sreq->sr_request;
|
||||||
memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd));
|
memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd));
|
||||||
cmd->serial_number = 0;
|
cmd->serial_number = 0;
|
||||||
cmd->serial_number_at_timeout = 0;
|
|
||||||
cmd->bufflen = sreq->sr_bufflen;
|
cmd->bufflen = sreq->sr_bufflen;
|
||||||
cmd->buffer = sreq->sr_buffer;
|
cmd->buffer = sreq->sr_buffer;
|
||||||
cmd->retries = 0;
|
cmd->retries = 0;
|
||||||
@ -765,7 +764,6 @@ void __scsi_done(struct scsi_cmnd *cmd)
|
|||||||
* Set the serial numbers back to zero
|
* Set the serial numbers back to zero
|
||||||
*/
|
*/
|
||||||
cmd->serial_number = 0;
|
cmd->serial_number = 0;
|
||||||
cmd->serial_number_at_timeout = 0;
|
|
||||||
cmd->state = SCSI_STATE_BHQUEUE;
|
cmd->state = SCSI_STATE_BHQUEUE;
|
||||||
cmd->owner = SCSI_OWNER_BH_HANDLER;
|
cmd->owner = SCSI_OWNER_BH_HANDLER;
|
||||||
|
|
||||||
|
@ -79,11 +79,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag)
|
|||||||
*/
|
*/
|
||||||
scmd->owner = SCSI_OWNER_ERROR_HANDLER;
|
scmd->owner = SCSI_OWNER_ERROR_HANDLER;
|
||||||
scmd->state = SCSI_STATE_FAILED;
|
scmd->state = SCSI_STATE_FAILED;
|
||||||
/*
|
|
||||||
* Set the serial_number_at_timeout to the current
|
|
||||||
* serial_number
|
|
||||||
*/
|
|
||||||
scmd->serial_number_at_timeout = scmd->serial_number;
|
|
||||||
list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
|
list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
|
||||||
set_bit(SHOST_RECOVERY, &shost->shost_state);
|
set_bit(SHOST_RECOVERY, &shost->shost_state);
|
||||||
shost->host_failed++;
|
shost->host_failed++;
|
||||||
@ -1061,7 +1056,6 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
|
|||||||
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
|
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__));
|
||||||
scmd->owner = SCSI_OWNER_LOWLEVEL;
|
scmd->owner = SCSI_OWNER_LOWLEVEL;
|
||||||
scmd->serial_number_at_timeout = scmd->serial_number;
|
|
||||||
|
|
||||||
if (!scmd->device->host->hostt->eh_bus_reset_handler)
|
if (!scmd->device->host->hostt->eh_bus_reset_handler)
|
||||||
return FAILED;
|
return FAILED;
|
||||||
@ -1093,7 +1087,6 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
|
|||||||
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
|
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__));
|
||||||
scmd->owner = SCSI_OWNER_LOWLEVEL;
|
scmd->owner = SCSI_OWNER_LOWLEVEL;
|
||||||
scmd->serial_number_at_timeout = scmd->serial_number;
|
|
||||||
|
|
||||||
if (!scmd->device->host->hostt->eh_host_reset_handler)
|
if (!scmd->device->host->hostt->eh_host_reset_handler)
|
||||||
return FAILED;
|
return FAILED;
|
||||||
|
@ -298,7 +298,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd)
|
|||||||
{
|
{
|
||||||
cmd->owner = SCSI_OWNER_MIDLEVEL;
|
cmd->owner = SCSI_OWNER_MIDLEVEL;
|
||||||
cmd->serial_number = 0;
|
cmd->serial_number = 0;
|
||||||
cmd->serial_number_at_timeout = 0;
|
|
||||||
cmd->abort_reason = 0;
|
cmd->abort_reason = 0;
|
||||||
|
|
||||||
memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);
|
memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);
|
||||||
|
@ -799,12 +799,6 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
|
|||||||
|
|
||||||
dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
|
dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* This one should be the result of some race, thus to ignore */
|
|
||||||
if (cmd->serial_number != cmd->serial_number_at_timeout)
|
|
||||||
goto prepare;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This one is queued in some place -> to wait for completion */
|
/* This one is queued in some place -> to wait for completion */
|
||||||
FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
|
FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
|
||||||
struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
|
struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
|
||||||
|
@ -43,21 +43,17 @@ struct scsi_cmnd {
|
|||||||
void (*done) (struct scsi_cmnd *); /* Mid-level done function */
|
void (*done) (struct scsi_cmnd *); /* Mid-level done function */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A SCSI Command is assigned a nonzero serial_number when internal_cmnd
|
* A SCSI Command is assigned a nonzero serial_number before passed
|
||||||
* passes it to the driver's queue command function. The serial_number
|
* to the driver's queue command function. The serial_number is
|
||||||
* is cleared when scsi_done is entered indicating that the command has
|
* cleared when scsi_done is entered indicating that the command
|
||||||
* been completed. If a timeout occurs, the serial number at the moment
|
* has been completed. It currently doesn't have much use other
|
||||||
* of timeout is copied into serial_number_at_timeout. By subsequently
|
* than printk's. Some lldd's use this number for other purposes.
|
||||||
* comparing the serial_number and serial_number_at_timeout fields
|
* It's almost certain that such usages are either incorrect or
|
||||||
* during abort or reset processing, we can detect whether the command
|
* meaningless. Please kill all usages other than printk's. Also,
|
||||||
* has already completed. This also detects cases where the command has
|
* as this number is always identical to ->pid, please convert
|
||||||
* completed and the SCSI Command structure has already being reused
|
* printk's to use ->pid, so that we can kill this field.
|
||||||
* for another command, so that we can avoid incorrectly aborting or
|
|
||||||
* resetting the new command.
|
|
||||||
* The serial number is only unique per host.
|
|
||||||
*/
|
*/
|
||||||
unsigned long serial_number;
|
unsigned long serial_number;
|
||||||
unsigned long serial_number_at_timeout;
|
|
||||||
|
|
||||||
int retries;
|
int retries;
|
||||||
int allowed;
|
int allowed;
|
||||||
|
Loading…
Reference in New Issue
Block a user