On 11/20/19 2:31 AM, Hannes Reinecke wrote:
Instead of waiting for all I/O to complete by monitoring the
request tags we can as well call scsi_host_quiesce() and drop
the hand-crafted helpers.
Cc: Balsundar P <balsundar.p@xxxxxxxxxxxxx>
Cc: Adaptec OEM Raid Solutions <aacraid@xxxxxxxxxxxxx>
Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
drivers/scsi/aacraid/comminit.c | 35 ++---------------------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index f75878d773cf..a01dca86eb37 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -272,38 +272,6 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem,
q->entries = qsize;
}
-static void aac_wait_for_io_completion(struct aac_dev *aac)
-{
- unsigned long flagv = 0;
- int i = 0;
-
- for (i = 60; i; --i) {
- struct scsi_device *dev;
- struct scsi_cmnd *command;
- int active = 0;
-
- __shost_for_each_device(dev, aac->scsi_host_ptr) {
- spin_lock_irqsave(&dev->list_lock, flagv);
- list_for_each_entry(command, &dev->cmd_list, list) {
- if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
- active++;
- break;
- }
- }
- spin_unlock_irqrestore(&dev->list_lock, flagv);
- if (active)
- break;
-
- }
- /*
- * We can exit If all the commands are complete
- */
- if (active == 0)
- break;
- ssleep(1);
- }
-}
-
/**
* aac_send_shutdown - shutdown an adapter
* @dev: Adapter to shutdown
@@ -326,7 +294,7 @@ int aac_send_shutdown(struct aac_dev * dev)
mutex_unlock(&dev->ioctl_mutex);
}
- aac_wait_for_io_completion(dev);
+ scsi_host_quiesce(dev->scsi_host_ptr);
fibctx = aac_fib_alloc(dev);
if (!fibctx)
@@ -352,6 +320,7 @@ int aac_send_shutdown(struct aac_dev * dev)
if (aac_is_src(dev) &&
dev->msi_enabled)
aac_set_intx_mode(dev);
+ scsi_host_resume(dev->scsi_host_ptr);
return status;
}
Can aac_wait_for_io_completion() be called from inside the aacraid SCSI
host reset handler? Is it safe to call scsi_host_quiesce() from inside a
host reset handler? Sorry that I sent you in the wrong direction with a
previous comment.
Bart.