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@xxxxxx> Cc: Kashyap Desai <kashyap.desai@xxxxxxxxxxxx> Cc: Sumanesh Samanta <sumanesh.samanta@xxxxxxxxxxxx> Cc: Ewan D. Milne <emilne@xxxxxxxxxx> Cc: Hannes Reinecke <hare@xxxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- 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();