diff options
author | Hannes Reinecke <hare@suse.de> | 2020-02-28 10:53:09 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-02-29 04:54:49 +0300 |
commit | 2c644b1d70f55cca58bb58a5a58652ee25afb28c (patch) | |
tree | 396d06ccaf7f4adccf3d5c558875d854a6045ec9 /drivers/scsi/aacraid/aachba.c | |
parent | 84ff9532e5308d04f97f032a434021ba1b01b6a3 (diff) | |
download | linux-2c644b1d70f55cca58bb58a5a58652ee25afb28c.tar.xz |
scsi: aacraid: Do not wait for outstanding write commands on synchronize_cache
There is no need to wait for outstanding write commands on synchronize
cache; the block layer is responsible for I/O scheduling, no need to
out-guess it in the driver layer.
Link: https://lore.kernel.org/r/20200228075318.91255-5-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Balsundar P <balsundar.b@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 33dbc051bff9..474d48eb1348 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2601,9 +2601,7 @@ static int aac_write(struct scsi_cmnd * scsicmd) static void synchronize_callback(void *context, struct fib *fibptr) { struct aac_synchronize_reply *synchronizereply; - struct scsi_cmnd *cmd; - - cmd = context; + struct scsi_cmnd *cmd = context; if (!aac_valid_context(cmd, fibptr)) return; @@ -2644,77 +2642,8 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) int status; struct fib *cmd_fibcontext; struct aac_synchronize *synchronizecmd; - struct scsi_cmnd *cmd; struct scsi_device *sdev = scsicmd->device; - int active = 0; struct aac_dev *aac; - u64 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | - (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; - u32 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; - unsigned long flags; - - /* - * Wait for all outstanding queued commands to complete to this - * specific target (block). - */ - spin_lock_irqsave(&sdev->list_lock, flags); - list_for_each_entry(cmd, &sdev->cmd_list, list) - if (cmd->SCp.phase == AAC_OWNER_FIRMWARE) { - u64 cmnd_lba; - u32 cmnd_count; - - if (cmd->cmnd[0] == WRITE_6) { - cmnd_lba = ((cmd->cmnd[1] & 0x1F) << 16) | - (cmd->cmnd[2] << 8) | - cmd->cmnd[3]; - cmnd_count = cmd->cmnd[4]; - if (cmnd_count == 0) - cmnd_count = 256; - } else if (cmd->cmnd[0] == WRITE_16) { - cmnd_lba = ((u64)cmd->cmnd[2] << 56) | - ((u64)cmd->cmnd[3] << 48) | - ((u64)cmd->cmnd[4] << 40) | - ((u64)cmd->cmnd[5] << 32) | - ((u64)cmd->cmnd[6] << 24) | - (cmd->cmnd[7] << 16) | - (cmd->cmnd[8] << 8) | - cmd->cmnd[9]; - cmnd_count = (cmd->cmnd[10] << 24) | - (cmd->cmnd[11] << 16) | - (cmd->cmnd[12] << 8) | - cmd->cmnd[13]; - } else if (cmd->cmnd[0] == WRITE_12) { - cmnd_lba = ((u64)cmd->cmnd[2] << 24) | - (cmd->cmnd[3] << 16) | - (cmd->cmnd[4] << 8) | - cmd->cmnd[5]; - cmnd_count = (cmd->cmnd[6] << 24) | - (cmd->cmnd[7] << 16) | - (cmd->cmnd[8] << 8) | - cmd->cmnd[9]; - } else if (cmd->cmnd[0] == WRITE_10) { - cmnd_lba = ((u64)cmd->cmnd[2] << 24) | - (cmd->cmnd[3] << 16) | - (cmd->cmnd[4] << 8) | - cmd->cmnd[5]; - cmnd_count = (cmd->cmnd[7] << 8) | - cmd->cmnd[8]; - } else - continue; - if (((cmnd_lba + cmnd_count) < lba) || - (count && ((lba + count) < cmnd_lba))) - continue; - ++active; - break; - } - - spin_unlock_irqrestore(&sdev->list_lock, flags); - - /* - * Yield the processor (requeue for later) - */ - if (active) - return SCSI_MLQUEUE_DEVICE_BUSY; aac = (struct aac_dev *)sdev->host->hostdata; if (aac->in_reset) @@ -2723,8 +2652,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) /* * Allocate and initialize a Fib */ - if (!(cmd_fibcontext = aac_fib_alloc(aac))) - return SCSI_MLQUEUE_HOST_BUSY; + cmd_fibcontext = aac_fib_alloc_tag(aac, scsicmd); aac_fib_init(cmd_fibcontext); |