diff options
author | <htejun@gmail.com> | 2005-04-03 15:59:11 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic> | 2005-04-16 21:14:26 -0400 |
commit | 84011ae88da62a20b3ae7b48e2ae3b1ef0fc810a (patch) | |
tree | d88217ed9b422449888310fd49e1709b7e541d67 | |
parent | 97665e9c22991401dc56968619c6b8b9c09f3268 (diff) |
[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>
-rw-r--r-- | drivers/scsi/BusLogic.c | 7 | ||||
-rw-r--r-- | drivers/scsi/advansys.c | 5 | ||||
-rw-r--r-- | drivers/scsi/ips.c | 7 | ||||
-rw-r--r-- | drivers/scsi/ncr53c8xx.c | 14 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 6 | ||||
-rw-r--r-- | drivers/scsi/scsi.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_error.c | 7 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_glue.c | 6 | ||||
-rw-r--r-- | include/scsi/scsi_cmnd.h | 22 |
10 files changed, 15 insertions, 62 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 41b5197ce4e6..15e4b122d56e 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -2958,13 +2958,6 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command) | |||
2958 | struct BusLogic_CCB *CCB; | 2958 | struct BusLogic_CCB *CCB; |
2959 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested); | 2959 | BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested); |
2960 | /* | 2960 | /* |
2961 | If this Command has already completed, then no Abort is necessary. | ||
2962 | */ | ||
2963 | if (Command->serial_number != Command->serial_number_at_timeout) { | ||
2964 | BusLogic_Warning("Unable to Abort Command to Target %d - " "Already Completed\n", HostAdapter, TargetID); | ||
2965 | return SUCCESS; | ||
2966 | } | ||
2967 | /* | ||
2968 | Attempt to find an Active CCB for this Command. If no Active CCB for this | 2961 | Attempt to find an Active CCB for this Command. If no Active CCB for this |
2969 | Command is found, then no Abort is necessary. | 2962 | Command is found, then no Abort is necessary. |
2970 | */ | 2963 | */ |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index edeb333d8161..04cb5c405a2d 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -9198,9 +9198,8 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s) | |||
9198 | s->use_sg, s->sglist_len, s->abort_reason); | 9198 | s->use_sg, s->sglist_len, s->abort_reason); |
9199 | 9199 | ||
9200 | printk( | 9200 | printk( |
9201 | " serial_number 0x%x, serial_number_at_timeout 0x%x, retries %d, allowed %d\n", | 9201 | " serial_number 0x%x, retries %d, allowed %d\n", |
9202 | (unsigned) s->serial_number, (unsigned) s->serial_number_at_timeout, | 9202 | (unsigned) s->serial_number, s->retries, s->allowed); |
9203 | s->retries, s->allowed); | ||
9204 | 9203 | ||
9205 | printk( | 9204 | printk( |
9206 | " timeout_per_command %d, timeout_total %d, timeout %d\n", | 9205 | " timeout_per_command %d, timeout_total %d, timeout %d\n", |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index e46096da8db2..47c263e5cd39 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -833,13 +833,6 @@ ips_eh_abort(Scsi_Cmnd * SC) | |||
833 | if (!ha->active) | 833 | if (!ha->active) |
834 | return (FAILED); | 834 | return (FAILED); |
835 | 835 | ||
836 | if (SC->serial_number != SC->serial_number_at_timeout) { | ||
837 | /* HMM, looks like a bogus command */ | ||
838 | DEBUG(1, "Abort called with bogus scsi command"); | ||
839 | |||
840 | return (FAILED); | ||
841 | } | ||
842 | |||
843 | /* See if the command is on the copp queue */ | 836 | /* See if the command is on the copp queue */ |
844 | item = ha->copp_waitlist.head; | 837 | item = ha->copp_waitlist.head; |
845 | while ((item) && (item->scsi_cmd != SC)) | 838 | while ((item) && (item->scsi_cmd != SC)) |
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index 7ae13236788e..2a0e42ec27d3 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c | |||
@@ -7486,24 +7486,14 @@ static int ncr53c8xx_abort(struct scsi_cmnd *cmd) | |||
7486 | struct scsi_cmnd *done_list; | 7486 | struct scsi_cmnd *done_list; |
7487 | 7487 | ||
7488 | #if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS | 7488 | #if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS |
7489 | printk("ncr53c8xx_abort: pid=%lu serial_number=%ld serial_number_at_timeout=%ld\n", | 7489 | printk("ncr53c8xx_abort: pid=%lu serial_number=%ld\n", |
7490 | cmd->pid, cmd->serial_number, cmd->serial_number_at_timeout); | 7490 | cmd->pid, cmd->serial_number); |
7491 | #else | 7491 | #else |
7492 | printk("ncr53c8xx_abort: command pid %lu\n", cmd->pid); | 7492 | printk("ncr53c8xx_abort: command pid %lu\n", cmd->pid); |
7493 | #endif | 7493 | #endif |
7494 | 7494 | ||
7495 | NCR_LOCK_NCB(np, flags); | 7495 | NCR_LOCK_NCB(np, flags); |
7496 | 7496 | ||
7497 | #if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS | ||
7498 | /* | ||
7499 | * We have to just ignore abort requests in some situations. | ||
7500 | */ | ||
7501 | if (cmd->serial_number != cmd->serial_number_at_timeout) { | ||
7502 | sts = SCSI_ABORT_NOT_RUNNING; | ||
7503 | goto out; | ||
7504 | } | ||
7505 | #endif | ||
7506 | |||
7507 | sts = ncr_abort_command(np, cmd); | 7497 | sts = ncr_abort_command(np, cmd); |
7508 | out: | 7498 | out: |
7509 | done_list = np->done_list; | 7499 | done_list = np->done_list; |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index dcc33daa5913..0e8ebbc56e81 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -1050,10 +1050,8 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) | |||
1050 | for (i = 0; i < cmd->cmd_len; i++) { | 1050 | for (i = 0; i < cmd->cmd_len; i++) { |
1051 | printk("0x%02x ", cmd->cmnd[i]); | 1051 | printk("0x%02x ", cmd->cmnd[i]); |
1052 | } | 1052 | } |
1053 | printk("\n seg_cnt=%d, allowed=%d, retries=%d, " | 1053 | printk("\n seg_cnt=%d, allowed=%d, retries=%d\n", |
1054 | "serial_number_at_timeout=0x%lx\n", | 1054 | cmd->use_sg, cmd->allowed, cmd->retries); |
1055 | cmd->use_sg, cmd->allowed, cmd->retries, | ||
1056 | cmd->serial_number_at_timeout); | ||
1057 | printk(" request buffer=0x%p, request buffer len=0x%x\n", | 1055 | printk(" request buffer=0x%p, request buffer len=0x%x\n", |
1058 | cmd->request_buffer, cmd->request_bufflen); | 1056 | cmd->request_buffer, cmd->request_bufflen); |
1059 | printk(" tag=%d, transfersize=0x%x\n", | 1057 | printk(" tag=%d, transfersize=0x%x\n", |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 95de4d0f4fd1..05d2bd075fd4 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -686,7 +686,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq) | |||
686 | cmd->request = sreq->sr_request; | 686 | cmd->request = sreq->sr_request; |
687 | memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd)); | 687 | memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd)); |
688 | cmd->serial_number = 0; | 688 | cmd->serial_number = 0; |
689 | cmd->serial_number_at_timeout = 0; | ||
690 | cmd->bufflen = sreq->sr_bufflen; | 689 | cmd->bufflen = sreq->sr_bufflen; |
691 | cmd->buffer = sreq->sr_buffer; | 690 | cmd->buffer = sreq->sr_buffer; |
692 | cmd->retries = 0; | 691 | cmd->retries = 0; |
@@ -765,7 +764,6 @@ void __scsi_done(struct scsi_cmnd *cmd) | |||
765 | * Set the serial numbers back to zero | 764 | * Set the serial numbers back to zero |
766 | */ | 765 | */ |
767 | cmd->serial_number = 0; | 766 | cmd->serial_number = 0; |
768 | cmd->serial_number_at_timeout = 0; | ||
769 | cmd->state = SCSI_STATE_BHQUEUE; | 767 | cmd->state = SCSI_STATE_BHQUEUE; |
770 | cmd->owner = SCSI_OWNER_BH_HANDLER; | 768 | cmd->owner = SCSI_OWNER_BH_HANDLER; |
771 | 769 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 173abb88e3e8..13bac93fc397 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -79,11 +79,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) | |||
79 | */ | 79 | */ |
80 | scmd->owner = SCSI_OWNER_ERROR_HANDLER; | 80 | scmd->owner = SCSI_OWNER_ERROR_HANDLER; |
81 | scmd->state = SCSI_STATE_FAILED; | 81 | scmd->state = SCSI_STATE_FAILED; |
82 | /* | ||
83 | * Set the serial_number_at_timeout to the current | ||
84 | * serial_number | ||
85 | */ | ||
86 | scmd->serial_number_at_timeout = scmd->serial_number; | ||
87 | list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); | 82 | list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); |
88 | set_bit(SHOST_RECOVERY, &shost->shost_state); | 83 | set_bit(SHOST_RECOVERY, &shost->shost_state); |
89 | shost->host_failed++; | 84 | shost->host_failed++; |
@@ -1061,7 +1056,6 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd) | |||
1061 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n", | 1056 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n", |
1062 | __FUNCTION__)); | 1057 | __FUNCTION__)); |
1063 | scmd->owner = SCSI_OWNER_LOWLEVEL; | 1058 | scmd->owner = SCSI_OWNER_LOWLEVEL; |
1064 | scmd->serial_number_at_timeout = scmd->serial_number; | ||
1065 | 1059 | ||
1066 | if (!scmd->device->host->hostt->eh_bus_reset_handler) | 1060 | if (!scmd->device->host->hostt->eh_bus_reset_handler) |
1067 | return FAILED; | 1061 | return FAILED; |
@@ -1093,7 +1087,6 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd) | |||
1093 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n", | 1087 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n", |
1094 | __FUNCTION__)); | 1088 | __FUNCTION__)); |
1095 | scmd->owner = SCSI_OWNER_LOWLEVEL; | 1089 | scmd->owner = SCSI_OWNER_LOWLEVEL; |
1096 | scmd->serial_number_at_timeout = scmd->serial_number; | ||
1097 | 1090 | ||
1098 | if (!scmd->device->host->hostt->eh_host_reset_handler) | 1091 | if (!scmd->device->host->hostt->eh_host_reset_handler) |
1099 | return FAILED; | 1092 | return FAILED; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 19dd911d9f7a..619d3fb7a2f0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -298,7 +298,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd) | |||
298 | { | 298 | { |
299 | cmd->owner = SCSI_OWNER_MIDLEVEL; | 299 | cmd->owner = SCSI_OWNER_MIDLEVEL; |
300 | cmd->serial_number = 0; | 300 | cmd->serial_number = 0; |
301 | cmd->serial_number_at_timeout = 0; | ||
302 | cmd->abort_reason = 0; | 301 | cmd->abort_reason = 0; |
303 | 302 | ||
304 | memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer); | 303 | memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer); |
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index a1dff6d437bc..5ff83d214f12 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -799,12 +799,6 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd) | |||
799 | 799 | ||
800 | dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname); | 800 | dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname); |
801 | 801 | ||
802 | #if 0 | ||
803 | /* This one should be the result of some race, thus to ignore */ | ||
804 | if (cmd->serial_number != cmd->serial_number_at_timeout) | ||
805 | goto prepare; | ||
806 | #endif | ||
807 | |||
808 | /* This one is queued in some place -> to wait for completion */ | 802 | /* This one is queued in some place -> to wait for completion */ |
809 | FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { | 803 | FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { |
810 | struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); | 804 | struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index ae45d6f8f98c..07f5c699eaa7 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -43,21 +43,17 @@ struct scsi_cmnd { | |||
43 | void (*done) (struct scsi_cmnd *); /* Mid-level done function */ | 43 | void (*done) (struct scsi_cmnd *); /* Mid-level done function */ |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * A SCSI Command is assigned a nonzero serial_number when internal_cmnd | 46 | * A SCSI Command is assigned a nonzero serial_number before passed |
47 | * passes it to the driver's queue command function. The serial_number | 47 | * to the driver's queue command function. The serial_number is |
48 | * is cleared when scsi_done is entered indicating that the command has | 48 | * cleared when scsi_done is entered indicating that the command |
49 | * been completed. If a timeout occurs, the serial number at the moment | 49 | * has been completed. It currently doesn't have much use other |
50 | * of timeout is copied into serial_number_at_timeout. By subsequently | 50 | * than printk's. Some lldd's use this number for other purposes. |
51 | * comparing the serial_number and serial_number_at_timeout fields | 51 | * It's almost certain that such usages are either incorrect or |
52 | * during abort or reset processing, we can detect whether the command | 52 | * meaningless. Please kill all usages other than printk's. Also, |
53 | * has already completed. This also detects cases where the command has | 53 | * as this number is always identical to ->pid, please convert |
54 | * completed and the SCSI Command structure has already being reused | 54 | * printk's to use ->pid, so that we can kill this field. |
55 | * for another command, so that we can avoid incorrectly aborting or | ||
56 | * resetting the new command. | ||
57 | * The serial number is only unique per host. | ||
58 | */ | 55 | */ |
59 | unsigned long serial_number; | 56 | unsigned long serial_number; |
60 | unsigned long serial_number_at_timeout; | ||
61 | 57 | ||
62 | int retries; | 58 | int retries; |
63 | int allowed; | 59 | int allowed; |