Commit 3d3ca53b authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: aacraid: use scsi_host_(block,unblock) to block I/O

Use scsi_host_block() and scsi_host_unblock() instead of
scsi_block_requests()/scsi_unblock_requests() to block and unblock I/O.
This has the advantage that the block layer will stop sending I/O to the
adapter instead of having the SCSI midlayer requeueing I/O internally.

Link: https://lore.kernel.org/r/20200228075318.91255-10-hare@suse.deReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: Balsundar P < Balsundar.P@microchip.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2bb95584
...@@ -1477,7 +1477,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) ...@@ -1477,7 +1477,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
int index, quirks; int index, quirks;
int retval; int retval;
struct Scsi_Host *host = aac->scsi_host_ptr; struct Scsi_Host *host = aac->scsi_host_ptr;
struct scsi_device *dev;
int jafo = 0; int jafo = 0;
int bled; int bled;
u64 dmamask; u64 dmamask;
...@@ -1605,16 +1604,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) ...@@ -1605,16 +1604,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
*/ */
scsi_host_complete_all_commands(host, DID_RESET); scsi_host_complete_all_commands(host, DID_RESET);
/*
* Any Device that was already marked offline needs to be marked
* running
*/
__shost_for_each_device(dev, host) {
if (!scsi_device_online(dev))
scsi_device_set_state(dev, SDEV_RUNNING);
}
retval = 0; retval = 0;
out: out:
aac->in_reset = 0; aac->in_reset = 0;
...@@ -1655,7 +1645,7 @@ int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) ...@@ -1655,7 +1645,7 @@ int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
* target (block maximum 60 seconds). Although not necessary, * target (block maximum 60 seconds). Although not necessary,
* it does make us a good storage citizen. * it does make us a good storage citizen.
*/ */
scsi_block_requests(host); scsi_host_block(host);
/* Quiesce build, flush cache, write through mode */ /* Quiesce build, flush cache, write through mode */
if (forced < 2) if (forced < 2)
...@@ -1666,7 +1656,7 @@ int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) ...@@ -1666,7 +1656,7 @@ int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
retval = _aac_reset_adapter(aac, bled, reset_type); retval = _aac_reset_adapter(aac, bled, reset_type);
spin_unlock_irqrestore(host->host_lock, flagv); spin_unlock_irqrestore(host->host_lock, flagv);
scsi_unblock_requests(host); retval = scsi_host_unblock(host, SDEV_RUNNING);
if ((forced < 2) && (retval == -ENODEV)) { if ((forced < 2) && (retval == -ENODEV)) {
/* Unwind aac_send_shutdown() IOP_RESET unsupported/disabled */ /* Unwind aac_send_shutdown() IOP_RESET unsupported/disabled */
......
...@@ -1894,7 +1894,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1894,7 +1894,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state)
struct Scsi_Host *shost = pci_get_drvdata(pdev); struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct aac_dev *aac = (struct aac_dev *)shost->hostdata; struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
scsi_block_requests(shost); scsi_host_block(shost);
aac_cancel_rescan_worker(aac); aac_cancel_rescan_worker(aac);
aac_send_shutdown(aac); aac_send_shutdown(aac);
...@@ -1930,7 +1930,7 @@ static int aac_resume(struct pci_dev *pdev) ...@@ -1930,7 +1930,7 @@ static int aac_resume(struct pci_dev *pdev)
* aac_send_shutdown() to block ioctls from upperlayer * aac_send_shutdown() to block ioctls from upperlayer
*/ */
aac->adapter_shutdown = 0; aac->adapter_shutdown = 0;
scsi_unblock_requests(shost); scsi_host_unblock(shost, SDEV_RUNNING);
return 0; return 0;
...@@ -1945,7 +1945,8 @@ static int aac_resume(struct pci_dev *pdev) ...@@ -1945,7 +1945,8 @@ static int aac_resume(struct pci_dev *pdev)
static void aac_shutdown(struct pci_dev *dev) static void aac_shutdown(struct pci_dev *dev)
{ {
struct Scsi_Host *shost = pci_get_drvdata(dev); struct Scsi_Host *shost = pci_get_drvdata(dev);
scsi_block_requests(shost);
scsi_host_block(shost);
__aac_shutdown((struct aac_dev *)shost->hostdata); __aac_shutdown((struct aac_dev *)shost->hostdata);
} }
...@@ -1991,7 +1992,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev, ...@@ -1991,7 +1992,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
case pci_channel_io_frozen: case pci_channel_io_frozen:
aac->handle_pci_error = 1; aac->handle_pci_error = 1;
scsi_block_requests(aac->scsi_host_ptr); scsi_host_block(shost);
aac_cancel_rescan_worker(aac); aac_cancel_rescan_worker(aac);
scsi_host_complete_all_commands(shost, DID_NO_CONNECT); scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
aac_release_resources(aac); aac_release_resources(aac);
...@@ -2044,7 +2045,6 @@ static pci_ers_result_t aac_pci_slot_reset(struct pci_dev *pdev) ...@@ -2044,7 +2045,6 @@ static pci_ers_result_t aac_pci_slot_reset(struct pci_dev *pdev)
static void aac_pci_resume(struct pci_dev *pdev) static void aac_pci_resume(struct pci_dev *pdev)
{ {
struct Scsi_Host *shost = pci_get_drvdata(pdev); struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct scsi_device *sdev = NULL;
struct aac_dev *aac = (struct aac_dev *)shost_priv(shost); struct aac_dev *aac = (struct aac_dev *)shost_priv(shost);
if (aac_adapter_ioremap(aac, aac->base_size)) { if (aac_adapter_ioremap(aac, aac->base_size)) {
...@@ -2071,10 +2071,7 @@ static void aac_pci_resume(struct pci_dev *pdev) ...@@ -2071,10 +2071,7 @@ static void aac_pci_resume(struct pci_dev *pdev)
aac->adapter_shutdown = 0; aac->adapter_shutdown = 0;
aac->handle_pci_error = 0; aac->handle_pci_error = 0;
shost_for_each_device(sdev, shost) scsi_host_unblock(shost, SDEV_RUNNING);
if (sdev->sdev_state == SDEV_OFFLINE)
sdev->sdev_state = SDEV_RUNNING;
scsi_unblock_requests(aac->scsi_host_ptr);
aac_scan_host(aac); aac_scan_host(aac);
pci_save_state(pdev); pci_save_state(pdev);
......
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