On Tue, Nov 30, 2021 at 03:33:08PM -0800, Bart Van Assche wrote: > The comment above scsi_device_max_queue_depth() and also the description > of commit ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <= > max(shost->can_queue, 1024)") contradict the implementation of the function > scsi_device_max_queue_depth(). Additionally, the maximum queue depth of a > SCSI LUN never exceeds host->can_queue. Fix scsi_device_max_queue_depth() > by changing max_t() into min_t(). > > Cc: Ming Lei <ming.lei@xxxxxxxxxx> > Cc: Hannes Reinecke <hare@xxxxxxx> > Cc: Sumanesh Samanta <sumanesh.samanta@xxxxxxxxxxxx> > Fixes: ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <= max(shost->can_queue, 1024)") > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > drivers/scsi/scsi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c > index dee4d9c6046d..211aace69c22 100644 > --- a/drivers/scsi/scsi.c > +++ b/drivers/scsi/scsi.c > @@ -200,11 +200,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd) > > > /* > - * 1024 is big enough for saturating the fast scsi LUN now > + * 1024 is big enough for saturating fast SCSI LUNs. > */ > int scsi_device_max_queue_depth(struct scsi_device *sdev) > { > - return max_t(int, sdev->host->can_queue, 1024); > + return min_t(int, sdev->host->can_queue, 1024); > } Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx> -- Ming