From: Bart Van Assche <bart.vanassche@sandisk.com> To: Jens Axboe <axboe@fb.com> Cc: Christoph Hellwig <hch@lst.de>, James Bottomley <jejb@linux.vnet.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, Mike Snitzer <snitzer@redhat.com>, Doug Ledford <dledford@redhat.com>, Keith Busch <keith.busch@intel.com>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>, "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org> Subject: [PATCH 8/9] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq Date: Mon, 26 Sep 2016 11:28:42 -0700 [thread overview] Message-ID: <456fc29e-a20f-51ec-631b-39ae311aa83a@sandisk.com> (raw) In-Reply-To: <7948dbb8-6333-dc62-2673-4da35b4dfdbc@sandisk.com> Ensure that if scsi-mq is enabled that srp_wait_for_queuecommand() waits until ongoing shost->hostt->queuecommand() calls have finished. For the !scsi-mq path, use blk_quiesce_queue() and blk_resume_queue() instead of busy-waiting. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: James Bottomley <jejb@linux.vnet.ibm.com> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Doug Ledford <dledford@redhat.com> --- drivers/scsi/scsi_transport_srp.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index e3cd3ec..841a3eb 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -24,7 +24,7 @@ #include <linux/err.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/delay.h> +#include <linux/blk-mq.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@ -402,34 +402,18 @@ static void srp_reconnect_work(struct work_struct *work) } } -/** - * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() - * @shost: SCSI host for which to count the number of scsi_request_fn() callers. - * - * To do: add support for scsi-mq in this function. - */ -static int scsi_request_fn_active(struct Scsi_Host *shost) +/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ +static void srp_wait_for_queuecommand(struct Scsi_Host *shost) { struct scsi_device *sdev; struct request_queue *q; - int request_fn_active = 0; shost_for_each_device(sdev, shost) { q = sdev->request_queue; - spin_lock_irq(q->queue_lock); - request_fn_active += q->request_fn_active; - spin_unlock_irq(q->queue_lock); + blk_quiesce_queue(q); + blk_resume_queue(q); } - - return request_fn_active; -} - -/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ -static void srp_wait_for_queuecommand(struct Scsi_Host *shost) -{ - while (scsi_request_fn_active(shost)) - msleep(20); } static void __rport_fail_io_fast(struct srp_rport *rport) -- 2.10.0
WARNING: multiple messages have this Message-ID (diff)
From: bart.vanassche@sandisk.com (Bart Van Assche) Subject: [PATCH 8/9] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq Date: Mon, 26 Sep 2016 11:28:42 -0700 [thread overview] Message-ID: <456fc29e-a20f-51ec-631b-39ae311aa83a@sandisk.com> (raw) In-Reply-To: <7948dbb8-6333-dc62-2673-4da35b4dfdbc@sandisk.com> Ensure that if scsi-mq is enabled that srp_wait_for_queuecommand() waits until ongoing shost->hostt->queuecommand() calls have finished. For the !scsi-mq path, use blk_quiesce_queue() and blk_resume_queue() instead of busy-waiting. Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com> Cc: James Bottomley <jejb at linux.vnet.ibm.com> Cc: Martin K. Petersen <martin.petersen at oracle.com> Cc: Doug Ledford <dledford at redhat.com> --- drivers/scsi/scsi_transport_srp.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index e3cd3ec..841a3eb 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -24,7 +24,7 @@ #include <linux/err.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/delay.h> +#include <linux/blk-mq.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@ -402,34 +402,18 @@ static void srp_reconnect_work(struct work_struct *work) } } -/** - * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() - * @shost: SCSI host for which to count the number of scsi_request_fn() callers. - * - * To do: add support for scsi-mq in this function. - */ -static int scsi_request_fn_active(struct Scsi_Host *shost) +/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ +static void srp_wait_for_queuecommand(struct Scsi_Host *shost) { struct scsi_device *sdev; struct request_queue *q; - int request_fn_active = 0; shost_for_each_device(sdev, shost) { q = sdev->request_queue; - spin_lock_irq(q->queue_lock); - request_fn_active += q->request_fn_active; - spin_unlock_irq(q->queue_lock); + blk_quiesce_queue(q); + blk_resume_queue(q); } - - return request_fn_active; -} - -/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ -static void srp_wait_for_queuecommand(struct Scsi_Host *shost) -{ - while (scsi_request_fn_active(shost)) - msleep(20); } static void __rport_fail_io_fast(struct srp_rport *rport) -- 2.10.0
next prev parent reply other threads:[~2016-09-26 18:28 UTC|newest] Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-09-26 18:25 [PATCH 0/9] Introduce blk_quiesce_queue() and blk_resume_queue() Bart Van Assche 2016-09-26 18:25 ` Bart Van Assche 2016-09-26 18:26 ` [PATCH 1/9] blk-mq: Introduce blk_mq_queue_stopped() Bart Van Assche 2016-09-26 18:26 ` Bart Van Assche 2016-09-26 18:26 ` Bart Van Assche 2016-09-27 6:20 ` Hannes Reinecke 2016-09-27 6:20 ` Hannes Reinecke 2016-09-27 7:38 ` Johannes Thumshirn 2016-09-27 7:38 ` Johannes Thumshirn 2016-09-27 7:38 ` Johannes Thumshirn 2016-09-26 18:26 ` [PATCH 2/9] dm: Fix a race condition related to stopping and starting queues Bart Van Assche 2016-09-26 18:26 ` Bart Van Assche 2016-09-27 6:21 ` Hannes Reinecke 2016-09-27 6:21 ` Hannes Reinecke 2016-09-27 6:21 ` Hannes Reinecke 2016-09-27 7:47 ` Johannes Thumshirn 2016-09-27 7:47 ` Johannes Thumshirn 2016-09-27 7:47 ` Johannes Thumshirn 2016-09-26 18:27 ` [PATCH 3/9] [RFC] nvme: Use BLK_MQ_S_STOPPED instead of QUEUE_FLAG_STOPPED in blk-mq code Bart Van Assche 2016-09-26 18:27 ` Bart Van Assche 2016-09-26 18:27 ` Bart Van Assche 2016-09-26 18:27 ` [PATCH 4/9] block: Move blk_freeze_queue() and blk_unfreeze_queue() code Bart Van Assche 2016-09-26 18:27 ` Bart Van Assche 2016-09-27 6:26 ` Hannes Reinecke 2016-09-27 6:26 ` Hannes Reinecke 2016-09-27 6:26 ` Hannes Reinecke 2016-09-27 7:52 ` Johannes Thumshirn 2016-09-27 7:52 ` Johannes Thumshirn 2016-09-27 7:52 ` Johannes Thumshirn 2016-09-26 18:27 ` [PATCH 5/9] block: Extend blk_freeze_queue_start() to the non-blk-mq path Bart Van Assche 2016-09-26 18:27 ` Bart Van Assche 2016-09-26 18:27 ` Bart Van Assche 2016-09-27 7:50 ` Johannes Thumshirn 2016-09-27 7:50 ` Johannes Thumshirn 2016-09-27 7:50 ` Johannes Thumshirn 2016-09-27 13:22 ` Ming Lei 2016-09-27 13:22 ` Ming Lei 2016-09-27 14:42 ` Bart Van Assche 2016-09-27 14:42 ` Bart Van Assche 2016-09-27 14:42 ` Bart Van Assche 2016-09-27 15:55 ` Bart Van Assche 2016-09-27 15:55 ` Bart Van Assche 2016-09-27 15:55 ` Bart Van Assche 2016-09-26 18:28 ` [PATCH 6/9] block: Rename mq_freeze_wq and mq_freeze_depth Bart Van Assche 2016-09-26 18:28 ` Bart Van Assche 2016-09-27 7:51 ` Johannes Thumshirn 2016-09-27 7:51 ` Johannes Thumshirn 2016-09-27 7:51 ` Johannes Thumshirn 2016-09-26 18:28 ` [PATCH 7/9] blk-mq: Introduce blk_quiesce_queue() and blk_resume_queue() Bart Van Assche 2016-09-26 18:28 ` Bart Van Assche 2016-09-26 18:28 ` Bart Van Assche [this message] 2016-09-26 18:28 ` [PATCH 8/9] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq Bart Van Assche 2016-09-26 18:28 ` [PATCH 9/9] [RFC] nvme: Fix a race condition Bart Van Assche 2016-09-26 18:28 ` Bart Van Assche 2016-09-27 16:31 ` Steve Wise 2016-09-27 16:31 ` Steve Wise 2016-09-27 16:31 ` Steve Wise 2016-09-27 16:43 ` Bart Van Assche 2016-09-27 16:43 ` Bart Van Assche 2016-09-27 16:43 ` Bart Van Assche 2016-09-27 16:56 ` James Bottomley 2016-09-27 16:56 ` James Bottomley 2016-09-27 17:09 ` Bart Van Assche 2016-09-27 17:09 ` Bart Van Assche 2016-09-27 17:09 ` Bart Van Assche 2016-09-28 14:23 ` Steve Wise 2016-09-28 14:23 ` Steve Wise 2016-09-28 14:23 ` Steve Wise 2016-09-27 16:56 ` Steve Wise 2016-09-27 16:56 ` Steve Wise 2016-09-27 16:56 ` Steve Wise 2016-09-26 18:33 ` [PATCH 0/9] Introduce blk_quiesce_queue() and blk_resume_queue() Mike Snitzer 2016-09-26 18:33 ` Mike Snitzer 2016-09-26 18:33 ` Mike Snitzer 2016-09-26 18:46 ` Bart Van Assche 2016-09-26 18:46 ` Bart Van Assche 2016-09-26 18:46 ` Bart Van Assche 2016-09-26 22:26 ` Bart Van Assche 2016-09-26 22:26 ` Bart Van Assche 2016-09-26 22:26 ` Bart Van Assche 2016-10-11 16:27 ` Laurence Oberman 2016-10-11 16:27 ` Laurence Oberman
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=456fc29e-a20f-51ec-631b-39ae311aa83a@sandisk.com \ --to=bart.vanassche@sandisk.com \ --cc=axboe@fb.com \ --cc=dledford@redhat.com \ --cc=hch@lst.de \ --cc=jejb@linux.vnet.ibm.com \ --cc=keith.busch@intel.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=linux-rdma@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=snitzer@redhat.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.