linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Bart van Assche <bvanassche@acm.org>,
	Balsundar P <balsundar.p@microchip.com>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Balsundar P <balsundar.p@microsemi.com>,
	Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 09/13] aacraid: use scsi_host_(block,unblock) to block I/O
Date: Wed,  4 Dec 2019 15:59:14 +0100	[thread overview]
Message-ID: <20191204145918.143134-10-hare@suse.de> (raw)
In-Reply-To: <20191204145918.143134-1-hare@suse.de>

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.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/commsup.c | 14 ++------------
 drivers/scsi/aacraid/linit.c   | 15 ++++++---------
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 0d8c1ee40759..9c227eefd14c 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1477,7 +1477,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	int index, quirks;
 	int retval;
 	struct Scsi_Host *host = aac->scsi_host_ptr;
-	struct scsi_device *dev;
 	int jafo = 0;
 	int bled;
 	u64 dmamask;
@@ -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);
 
-	/*
-	 * 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;
-
 out:
 	aac->in_reset = 0;
 
@@ -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,
 	 * it does make us a good storage citizen.
 	 */
-	scsi_block_requests(host);
+	scsi_host_block(host);
 
 	/* Quiesce build, flush cache, write through mode */
 	if (forced < 2)
@@ -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);
 	spin_unlock_irqrestore(host->host_lock, flagv);
 
-	scsi_unblock_requests(host);
+	retval = scsi_host_unblock(host, SDEV_RUNNING);
 
 	if ((forced < 2) && (retval == -ENODEV)) {
 		/* Unwind aac_send_shutdown() IOP_RESET unsupported/disabled */
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 4d5b34e0d3a9..877464e9d520 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -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 aac_dev *aac = (struct aac_dev *)shost->hostdata;
 
-	scsi_block_requests(shost);
+	scsi_host_block(shost);
 	aac_cancel_rescan_worker(aac);
 	aac_send_shutdown(aac);
 
@@ -1930,7 +1930,7 @@ static int aac_resume(struct pci_dev *pdev)
 	* aac_send_shutdown() to block ioctls from upperlayer
 	*/
 	aac->adapter_shutdown = 0;
-	scsi_unblock_requests(shost);
+	scsi_host_unblock(shost, SDEV_RUNNING);
 
 	return 0;
 
@@ -1945,7 +1945,8 @@ static int aac_resume(struct pci_dev *pdev)
 static void aac_shutdown(struct pci_dev *dev)
 {
 	struct Scsi_Host *shost = pci_get_drvdata(dev);
-	scsi_block_requests(shost);
+
+	scsi_host_block(shost);
 	__aac_shutdown((struct aac_dev *)shost->hostdata);
 }
 
@@ -1991,7 +1992,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 	case pci_channel_io_frozen:
 		aac->handle_pci_error = 1;
 
-		scsi_block_requests(aac->scsi_host_ptr);
+		scsi_host_block(shost);
 		aac_cancel_rescan_worker(aac);
 		scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
 		aac_release_resources(aac);
@@ -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)
 {
 	struct Scsi_Host *shost = pci_get_drvdata(pdev);
-	struct scsi_device *sdev = NULL;
 	struct aac_dev *aac = (struct aac_dev *)shost_priv(shost);
 
 	if (aac_adapter_ioremap(aac, aac->base_size)) {
@@ -2071,10 +2071,7 @@ static void aac_pci_resume(struct pci_dev *pdev)
 	aac->adapter_shutdown = 0;
 	aac->handle_pci_error = 0;
 
-	shost_for_each_device(sdev, shost)
-		if (sdev->sdev_state == SDEV_OFFLINE)
-			sdev->sdev_state = SDEV_RUNNING;
-	scsi_unblock_requests(aac->scsi_host_ptr);
+	scsi_host_unblock(shost, SDEV_RUNNING);
 	aac_scan_host(aac);
 	pci_save_state(pdev);
 
-- 
2.16.4


  parent reply	other threads:[~2019-12-04 14:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 14:59 [PATCHv6 00/13] scsi: remove legacy cmd_list implementation Hannes Reinecke
2019-12-04 14:59 ` [PATCH 01/13] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete() Hannes Reinecke
2019-12-04 14:59 ` [PATCH 02/13] scsi: add scsi_host_complete_all_commands() helper Hannes Reinecke
2019-12-04 14:59 ` [PATCH 03/13] dpt_i2o: use scsi_host_complete_all_commands() to abort outstanding commands Hannes Reinecke
2019-12-04 14:59 ` [PATCH 04/13] aacraid: Do not wait for outstanding write commands on synchronize_cache Hannes Reinecke
2019-12-10  4:58   ` Balsundar.P
2019-12-04 14:59 ` [PATCH 05/13] aacraid: use scsi_host_complete_all_commands() to terminate outstanding commands Hannes Reinecke
2019-12-10  4:58   ` Balsundar.P
2019-12-04 14:59 ` [PATCH 06/13] aacraid: replace aac_flush_ios() with midlayer helper Hannes Reinecke
2019-12-10  4:59   ` Balsundar.P
2019-12-04 14:59 ` [PATCH 07/13] aacraid: move scsi_(block,unblock)_requests out of _aac_reset_adapter() Hannes Reinecke
2019-12-10  5:00   ` Balsundar.P
2019-12-04 14:59 ` [PATCH 08/13] scsi: add scsi_host_(block,unblock) helper function Hannes Reinecke
2019-12-04 14:59 ` Hannes Reinecke [this message]
2019-12-10  5:01   ` [PATCH 09/13] aacraid: use scsi_host_(block,unblock) to block I/O Balsundar.P
2019-12-04 14:59 ` [PATCH 10/13] scsi: add scsi_host_busy_iter() Hannes Reinecke
2019-12-04 14:59 ` [PATCH 11/13] aacraid: use scsi_host_busy_iter() to wait for outstanding commands Hannes Reinecke
2019-12-10  5:01   ` Balsundar.P
2019-12-04 14:59 ` [PATCH 12/13] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs() Hannes Reinecke
2019-12-10  5:02   ` Balsundar.P
2019-12-04 14:59 ` [PATCH 13/13] scsi: Remove cmd_list functionality Hannes Reinecke
2020-02-13 14:04 [PATCHv7 00/13] scsi: remove legacy cmd_list implementation Hannes Reinecke
2020-02-13 14:04 ` [PATCH 09/13] aacraid: use scsi_host_(block,unblock) to block I/O Hannes Reinecke
2020-02-26 17:43   ` Christoph Hellwig
2020-02-28  7:53 [PATCHv8 00/13] scsi: remove legacy cmd_list implementation Hannes Reinecke
2020-02-28  7:53 ` [PATCH 09/13] aacraid: use scsi_host_(block,unblock) to block I/O Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191204145918.143134-10-hare@suse.de \
    --to=hare@suse.de \
    --cc=aacraid@microsemi.com \
    --cc=balsundar.p@microchip.com \
    --cc=balsundar.p@microsemi.com \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).