Message ID | 20200923013339.1621784-12-ming.lei@redhat.com |
---|---|
State | New |
Headers | show |
Series | blk-mq/scsi: tracking device queue depth via sbitmap | expand |
On 9/23/20 3:33 AM, Ming Lei wrote: > Obviously scsi device's queue depth can't be > host's can_queue, > so make it explicitely in scsi_change_queue_depth(). > > Cc: Omar Sandoval <osandov@fb.com> > Cc: Kashyap Desai <kashyap.desai@broadcom.com> > Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com> > Cc: Ewan D. Milne <emilne@redhat.com> > Cc: Hannes Reinecke <hare@suse.de> > Signed-off-by: Ming Lei <ming.lei@redhat.com> > --- > drivers/scsi/scsi.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c > index 24619c3bebd5..cc6ff1ae8c16 100644 > --- a/drivers/scsi/scsi.c > +++ b/drivers/scsi/scsi.c > @@ -223,6 +223,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd) > */ > int scsi_change_queue_depth(struct scsi_device *sdev, int depth) > { > + depth = min_t(int, depth, sdev->host->can_queue); > + > if (depth > 0) { > sdev->queue_depth = depth; > wmb(); > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
On 23/09/2020 02:33, Ming Lei wrote: > Obviously scsi device's queue depth can't be > host's can_queue, > so make it explicitely in scsi_change_queue_depth(). ha, why not can_queue * nr_hw_queues? > > Cc: Omar Sandoval <osandov@fb.com> > Cc: Kashyap Desai <kashyap.desai@broadcom.com> > Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com> > Cc: Ewan D. Milne <emilne@redhat.com> > Cc: Hannes Reinecke <hare@suse.de> > Signed-off-by: Ming Lei <ming.lei@redhat.com> > --- > drivers/scsi/scsi.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c > index 24619c3bebd5..cc6ff1ae8c16 100644 > --- a/drivers/scsi/scsi.c > +++ b/drivers/scsi/scsi.c > @@ -223,6 +223,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd) > */ > int scsi_change_queue_depth(struct scsi_device *sdev, int depth) > { > + depth = min_t(int, depth, sdev->host->can_queue); > + > if (depth > 0) { > sdev->queue_depth = depth; > wmb(); >
On Wed, Sep 23, 2020 at 08:38:44AM +0100, John Garry wrote: > On 23/09/2020 02:33, Ming Lei wrote: > > Obviously scsi device's queue depth can't be > host's can_queue, > > so make it explicitely in scsi_change_queue_depth(). > > ha, why not can_queue * nr_hw_queues? Yeah, you are right, it should be can_queue * nr_hw_queues for non-shared-tags. Thanks, Ming
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 24619c3bebd5..cc6ff1ae8c16 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -223,6 +223,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd) */ int scsi_change_queue_depth(struct scsi_device *sdev, int depth) { + depth = min_t(int, depth, sdev->host->can_queue); + if (depth > 0) { sdev->queue_depth = depth; wmb();
Obviously scsi device's queue depth can't be > host's can_queue, so make it explicitely in scsi_change_queue_depth(). Cc: Omar Sandoval <osandov@fb.com> Cc: Kashyap Desai <kashyap.desai@broadcom.com> Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com> Cc: Ewan D. Milne <emilne@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/scsi/scsi.c | 2 ++ 1 file changed, 2 insertions(+)