diff options
author | Christoph Hellwig <hch@lst.de> | 2005-06-19 07:42:05 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-06-26 13:16:24 -0400 |
commit | 8d115f845a0bd59cd263e791f739964f42b7b0e8 (patch) | |
tree | 8d4af0e70f0d8d5c04e2efa1d68fe507dc5d8923 /drivers/scsi | |
parent | b4edcbcafdecc80ef5356ff6452768b1b926ea76 (diff) |
[SCSI] remove scsi_cmnd->state
We never look at it except for the old megaraid driver that abuses it
for sending internal commands. That usage can be fixed easily because
those internal commands are single-threaded by a mutex and we can easily
use a completion there.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/megaraid.c | 26 | ||||
-rw-r--r-- | drivers/scsi/megaraid.h | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi.c | 7 | ||||
-rw-r--r-- | drivers/scsi/scsi_error.c | 7 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 5 |
5 files changed, 5 insertions, 42 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 6ee88c59953e..6fe884a2d00d 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/blkdev.h> | 35 | #include <linux/blkdev.h> |
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | #include <linux/completion.h> | ||
38 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
39 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
40 | #include <linux/reboot.h> | 41 | #include <linux/reboot.h> |
@@ -4477,8 +4478,6 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, | |||
4477 | 4478 | ||
4478 | scb->idx = CMDID_INT_CMDS; | 4479 | scb->idx = CMDID_INT_CMDS; |
4479 | 4480 | ||
4480 | scmd->state = 0; | ||
4481 | |||
4482 | /* | 4481 | /* |
4483 | * Get the lock only if the caller has not acquired it already | 4482 | * Get the lock only if the caller has not acquired it already |
4484 | */ | 4483 | */ |
@@ -4488,15 +4487,7 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, | |||
4488 | 4487 | ||
4489 | if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags); | 4488 | if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags); |
4490 | 4489 | ||
4491 | /* | 4490 | wait_for_completion(&adapter->int_waitq); |
4492 | * Wait till this command finishes. Do not use | ||
4493 | * wait_event_interruptible(). It causes panic if CTRL-C is hit when | ||
4494 | * dumping e.g., physical disk information through /proc interface. | ||
4495 | */ | ||
4496 | #if 0 | ||
4497 | wait_event_interruptible(adapter->int_waitq, scmd->state); | ||
4498 | #endif | ||
4499 | wait_event(adapter->int_waitq, scmd->state); | ||
4500 | 4491 | ||
4501 | rval = scmd->result; | 4492 | rval = scmd->result; |
4502 | mc->status = scmd->result; | 4493 | mc->status = scmd->result; |
@@ -4530,16 +4521,7 @@ mega_internal_done(Scsi_Cmnd *scmd) | |||
4530 | 4521 | ||
4531 | adapter = (adapter_t *)scmd->device->host->hostdata; | 4522 | adapter = (adapter_t *)scmd->device->host->hostdata; |
4532 | 4523 | ||
4533 | scmd->state = 1; /* thread waiting for its command to complete */ | 4524 | complete(&adapter->int_waitq); |
4534 | |||
4535 | /* | ||
4536 | * See comment in mega_internal_command() routine for | ||
4537 | * wait_event_interruptible() | ||
4538 | */ | ||
4539 | #if 0 | ||
4540 | wake_up_interruptible(&adapter->int_waitq); | ||
4541 | #endif | ||
4542 | wake_up(&adapter->int_waitq); | ||
4543 | 4525 | ||
4544 | } | 4526 | } |
4545 | 4527 | ||
@@ -4861,7 +4843,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
4861 | } | 4843 | } |
4862 | 4844 | ||
4863 | init_MUTEX(&adapter->int_mtx); | 4845 | init_MUTEX(&adapter->int_mtx); |
4864 | init_waitqueue_head(&adapter->int_waitq); | 4846 | init_completion(&adapter->int_waitq); |
4865 | 4847 | ||
4866 | adapter->this_id = DEFAULT_INITIATOR_ID; | 4848 | adapter->this_id = DEFAULT_INITIATOR_ID; |
4867 | adapter->host->this_id = DEFAULT_INITIATOR_ID; | 4849 | adapter->host->this_id = DEFAULT_INITIATOR_ID; |
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index e25c4de9edd9..4facf557cd19 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -891,7 +891,7 @@ typedef struct { | |||
891 | Scsi_Cmnd int_scmd; | 891 | Scsi_Cmnd int_scmd; |
892 | struct semaphore int_mtx; /* To synchronize the internal | 892 | struct semaphore int_mtx; /* To synchronize the internal |
893 | commands */ | 893 | commands */ |
894 | wait_queue_head_t int_waitq; /* wait queue for internal | 894 | struct completion int_waitq; /* wait queue for internal |
895 | cmds */ | 895 | cmds */ |
896 | 896 | ||
897 | int has_cluster; /* cluster support on this HBA */ | 897 | int has_cluster; /* cluster support on this HBA */ |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index b25e5e531eb9..1afe1e592af4 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -259,7 +259,6 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) | |||
259 | 259 | ||
260 | memset(cmd, 0, sizeof(*cmd)); | 260 | memset(cmd, 0, sizeof(*cmd)); |
261 | cmd->device = dev; | 261 | cmd->device = dev; |
262 | cmd->state = SCSI_STATE_UNUSED; | ||
263 | init_timer(&cmd->eh_timeout); | 262 | init_timer(&cmd->eh_timeout); |
264 | INIT_LIST_HEAD(&cmd->list); | 263 | INIT_LIST_HEAD(&cmd->list); |
265 | spin_lock_irqsave(&dev->list_lock, flags); | 264 | spin_lock_irqsave(&dev->list_lock, flags); |
@@ -609,9 +608,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | |||
609 | * We will use a queued command if possible, otherwise we will | 608 | * We will use a queued command if possible, otherwise we will |
610 | * emulate the queuing and calling of completion function ourselves. | 609 | * emulate the queuing and calling of completion function ourselves. |
611 | */ | 610 | */ |
612 | |||
613 | cmd->state = SCSI_STATE_QUEUED; | ||
614 | |||
615 | atomic_inc(&cmd->device->iorequest_cnt); | 611 | atomic_inc(&cmd->device->iorequest_cnt); |
616 | 612 | ||
617 | /* | 613 | /* |
@@ -764,7 +760,6 @@ void __scsi_done(struct scsi_cmnd *cmd) | |||
764 | * Set the serial numbers back to zero | 760 | * Set the serial numbers back to zero |
765 | */ | 761 | */ |
766 | cmd->serial_number = 0; | 762 | cmd->serial_number = 0; |
767 | cmd->state = SCSI_STATE_BHQUEUE; | ||
768 | 763 | ||
769 | atomic_inc(&cmd->device->iodone_cnt); | 764 | atomic_inc(&cmd->device->iodone_cnt); |
770 | if (cmd->result) | 765 | if (cmd->result) |
@@ -885,8 +880,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
885 | SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion " | 880 | SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion " |
886 | "for device %d %x\n", sdev->id, cmd->result)); | 881 | "for device %d %x\n", sdev->id, cmd->result)); |
887 | 882 | ||
888 | cmd->state = SCSI_STATE_FINISHED; | ||
889 | |||
890 | /* | 883 | /* |
891 | * We can get here with use_sg=0, causing a panic in the upper level | 884 | * We can get here with use_sg=0, causing a panic in the upper level |
892 | */ | 885 | */ |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 0df8615732c1..4f312da021f1 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -74,10 +74,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) | |||
74 | spin_lock_irqsave(shost->host_lock, flags); | 74 | spin_lock_irqsave(shost->host_lock, flags); |
75 | 75 | ||
76 | scsi_eh_eflags_set(scmd, eh_flag); | 76 | scsi_eh_eflags_set(scmd, eh_flag); |
77 | /* | ||
78 | * FIXME: Can we stop setting owner and state. | ||
79 | */ | ||
80 | scmd->state = SCSI_STATE_FAILED; | ||
81 | list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); | 77 | list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); |
82 | set_bit(SHOST_RECOVERY, &shost->shost_state); | 78 | set_bit(SHOST_RECOVERY, &shost->shost_state); |
83 | shost->host_failed++; | 79 | shost->host_failed++; |
@@ -634,8 +630,6 @@ static void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, | |||
634 | struct list_head *done_q) | 630 | struct list_head *done_q) |
635 | { | 631 | { |
636 | scmd->device->host->host_failed--; | 632 | scmd->device->host->host_failed--; |
637 | scmd->state = SCSI_STATE_BHQUEUE; | ||
638 | |||
639 | scsi_eh_eflags_clr_all(scmd); | 633 | scsi_eh_eflags_clr_all(scmd); |
640 | 634 | ||
641 | /* | 635 | /* |
@@ -1803,7 +1797,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
1803 | scmd->request = &req; | 1797 | scmd->request = &req; |
1804 | memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); | 1798 | memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); |
1805 | scmd->request->rq_status = RQ_SCSI_BUSY; | 1799 | scmd->request->rq_status = RQ_SCSI_BUSY; |
1806 | scmd->state = SCSI_STATE_INITIALIZING; | ||
1807 | 1800 | ||
1808 | memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); | 1801 | memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); |
1809 | 1802 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 912cea081119..58dcb0534a26 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -146,11 +146,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) | |||
146 | device->device_blocked = device->max_device_blocked; | 146 | device->device_blocked = device->max_device_blocked; |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * Register the fact that we own the thing for now. | ||
150 | */ | ||
151 | cmd->state = SCSI_STATE_MLQUEUE; | ||
152 | |||
153 | /* | ||
154 | * Decrement the counters, since these commands are no longer | 149 | * Decrement the counters, since these commands are no longer |
155 | * active on the host/device. | 150 | * active on the host/device. |
156 | */ | 151 | */ |