Message ID | bedf4b45-00b0-6844-047d-f1e05bb1092f@sandisk.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 <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 | 24 ++++++++++++++++++++---- > 1 file changed, 20 insertions(+), 4 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes
> +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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/05/2016 10:38 AM, Sagi Grimberg wrote: >> +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. Hello Sagi, 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. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 <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> @@ -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)
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 <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 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)