Re: [PATCH v2 6/7] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq
On Wed, Oct 05, 2016 at 02:51:50PM -0700, Bart Van Assche wrote: > There are multiple direct blk_*() calls in other SCSI transport drivers. So > my proposal is to wait with moving this code into scsi_lib.c until there is > a second user of this code. I still don't think these low-level difference for blk-mq vs legacy request belong into a scsi LLDD. So I concur with Sagi that this should go into the core SCSI code. In fact I suspect we should just call it directly from scsi_internal_device_block, and maybe even scsi_internal_device_unblock for case of setting the device offline. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq
+static void srp_mq_wait_for_queuecommand(struct Scsi_Host *shost) +{ + struct scsi_device *sdev; + struct request_queue *q; + + shost_for_each_device(sdev, shost) { + q = sdev->request_queue; + + blk_mq_quiesce_queue(q); + blk_mq_resume_queue(q); + } +} + This *should* live in scsi_lib.c. I suspect that various drivers would really want this functionality. Thoughts? -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq
On 09/29/2016 02:01 AM, Bart Van Assche wrote: > Ensure that if scsi-mq is enabled that srp_wait_for_queuecommand() > waits until ongoing shost->hostt->queuecommand() calls have finished. > > Signed-off-by: Bart Van Assche> Cc: James Bottomley > Cc: Martin K. Petersen > Cc: Doug Ledford > --- > drivers/scsi/scsi_transport_srp.c | 24 > 1 file changed, 20 insertions(+), 4 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 6/7] SRP transport: Port srp_wait_for_queuecommand() to scsi-mq
Ensure that if scsi-mq is enabled that srp_wait_for_queuecommand() waits until ongoing shost->hostt->queuecommand() calls have finished. Signed-off-by: Bart Van AsscheCc: James Bottomley Cc: Martin K. Petersen Cc: Doug Ledford --- drivers/scsi/scsi_transport_srp.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index e3cd3ec..f1d580e 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -405,8 +406,6 @@ 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) { @@ -425,11 +424,28 @@ static int scsi_request_fn_active(struct Scsi_Host *shost) return request_fn_active; } +static void srp_mq_wait_for_queuecommand(struct Scsi_Host *shost) +{ + struct scsi_device *sdev; + struct request_queue *q; + + shost_for_each_device(sdev, shost) { + q = sdev->request_queue; + + blk_mq_quiesce_queue(q); + blk_mq_resume_queue(q); + } +} + /* 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); + if (shost->use_blk_mq) { + srp_mq_wait_for_queuecommand(shost); + } else { + while (scsi_request_fn_active(shost)) + msleep(20); + } } static void __rport_fail_io_fast(struct srp_rport *rport) -- 2.10.0 -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html