Commit 8d115f84 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[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: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b4edcbca
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/completion.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/reboot.h> #include <linux/reboot.h>
...@@ -4477,8 +4478,6 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, ...@@ -4477,8 +4478,6 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
scb->idx = CMDID_INT_CMDS; scb->idx = CMDID_INT_CMDS;
scmd->state = 0;
/* /*
* Get the lock only if the caller has not acquired it already * Get the lock only if the caller has not acquired it already
*/ */
...@@ -4488,15 +4487,7 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, ...@@ -4488,15 +4487,7 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags); if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags);
/* wait_for_completion(&adapter->int_waitq);
* Wait till this command finishes. Do not use
* wait_event_interruptible(). It causes panic if CTRL-C is hit when
* dumping e.g., physical disk information through /proc interface.
*/
#if 0
wait_event_interruptible(adapter->int_waitq, scmd->state);
#endif
wait_event(adapter->int_waitq, scmd->state);
rval = scmd->result; rval = scmd->result;
mc->status = scmd->result; mc->status = scmd->result;
...@@ -4530,16 +4521,7 @@ mega_internal_done(Scsi_Cmnd *scmd) ...@@ -4530,16 +4521,7 @@ mega_internal_done(Scsi_Cmnd *scmd)
adapter = (adapter_t *)scmd->device->host->hostdata; adapter = (adapter_t *)scmd->device->host->hostdata;
scmd->state = 1; /* thread waiting for its command to complete */ complete(&adapter->int_waitq);
/*
* See comment in mega_internal_command() routine for
* wait_event_interruptible()
*/
#if 0
wake_up_interruptible(&adapter->int_waitq);
#endif
wake_up(&adapter->int_waitq);
} }
...@@ -4861,7 +4843,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4861,7 +4843,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
} }
init_MUTEX(&adapter->int_mtx); init_MUTEX(&adapter->int_mtx);
init_waitqueue_head(&adapter->int_waitq); init_completion(&adapter->int_waitq);
adapter->this_id = DEFAULT_INITIATOR_ID; adapter->this_id = DEFAULT_INITIATOR_ID;
adapter->host->this_id = DEFAULT_INITIATOR_ID; adapter->host->this_id = DEFAULT_INITIATOR_ID;
......
...@@ -891,7 +891,7 @@ typedef struct { ...@@ -891,7 +891,7 @@ typedef struct {
Scsi_Cmnd int_scmd; Scsi_Cmnd int_scmd;
struct semaphore int_mtx; /* To synchronize the internal struct semaphore int_mtx; /* To synchronize the internal
commands */ commands */
wait_queue_head_t int_waitq; /* wait queue for internal struct completion int_waitq; /* wait queue for internal
cmds */ cmds */
int has_cluster; /* cluster support on this HBA */ int has_cluster; /* cluster support on this HBA */
......
...@@ -259,7 +259,6 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) ...@@ -259,7 +259,6 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask)
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
cmd->device = dev; cmd->device = dev;
cmd->state = SCSI_STATE_UNUSED;
init_timer(&cmd->eh_timeout); init_timer(&cmd->eh_timeout);
INIT_LIST_HEAD(&cmd->list); INIT_LIST_HEAD(&cmd->list);
spin_lock_irqsave(&dev->list_lock, flags); spin_lock_irqsave(&dev->list_lock, flags);
...@@ -609,9 +608,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) ...@@ -609,9 +608,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
* We will use a queued command if possible, otherwise we will * We will use a queued command if possible, otherwise we will
* emulate the queuing and calling of completion function ourselves. * emulate the queuing and calling of completion function ourselves.
*/ */
cmd->state = SCSI_STATE_QUEUED;
atomic_inc(&cmd->device->iorequest_cnt); atomic_inc(&cmd->device->iorequest_cnt);
/* /*
...@@ -764,7 +760,6 @@ void __scsi_done(struct scsi_cmnd *cmd) ...@@ -764,7 +760,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->state = SCSI_STATE_BHQUEUE;
atomic_inc(&cmd->device->iodone_cnt); atomic_inc(&cmd->device->iodone_cnt);
if (cmd->result) if (cmd->result)
...@@ -885,8 +880,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) ...@@ -885,8 +880,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion " SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion "
"for device %d %x\n", sdev->id, cmd->result)); "for device %d %x\n", sdev->id, cmd->result));
cmd->state = SCSI_STATE_FINISHED;
/* /*
* We can get here with use_sg=0, causing a panic in the upper level * We can get here with use_sg=0, causing a panic in the upper level
*/ */
......
...@@ -74,10 +74,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) ...@@ -74,10 +74,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag)
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
scsi_eh_eflags_set(scmd, eh_flag); scsi_eh_eflags_set(scmd, eh_flag);
/*
* FIXME: Can we stop setting owner and state.
*/
scmd->state = SCSI_STATE_FAILED;
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++;
...@@ -634,8 +630,6 @@ static void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, ...@@ -634,8 +630,6 @@ static void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
struct list_head *done_q) struct list_head *done_q)
{ {
scmd->device->host->host_failed--; scmd->device->host->host_failed--;
scmd->state = SCSI_STATE_BHQUEUE;
scsi_eh_eflags_clr_all(scmd); scsi_eh_eflags_clr_all(scmd);
/* /*
...@@ -1803,7 +1797,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) ...@@ -1803,7 +1797,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
scmd->request = &req; scmd->request = &req;
memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));
scmd->request->rq_status = RQ_SCSI_BUSY; scmd->request->rq_status = RQ_SCSI_BUSY;
scmd->state = SCSI_STATE_INITIALIZING;
memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd));
......
...@@ -145,11 +145,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) ...@@ -145,11 +145,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
else if (reason == SCSI_MLQUEUE_DEVICE_BUSY) else if (reason == SCSI_MLQUEUE_DEVICE_BUSY)
device->device_blocked = device->max_device_blocked; device->device_blocked = device->max_device_blocked;
/*
* Register the fact that we own the thing for now.
*/
cmd->state = SCSI_STATE_MLQUEUE;
/* /*
* Decrement the counters, since these commands are no longer * Decrement the counters, since these commands are no longer
* active on the host/device. * active on the host/device.
......
...@@ -31,7 +31,6 @@ struct scsi_cmnd { ...@@ -31,7 +31,6 @@ struct scsi_cmnd {
int sc_magic; int sc_magic;
struct scsi_device *device; struct scsi_device *device;
unsigned short state;
struct scsi_request *sc_request; struct scsi_request *sc_request;
struct list_head list; /* scsi_cmnd participates in queue lists */ struct list_head list; /* scsi_cmnd participates in queue lists */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment