]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Reallocate device's budget map on queue depth change
authorMing Lei <ming.lei@redhat.com>
Thu, 27 Jan 2022 15:37:33 +0000 (23:37 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 31 Jan 2022 17:56:01 +0000 (12:56 -0500)
commitf8f827a9bec85026d45aae146d78c0b2324ed97e
tree55c214c1b42bbe7105e4a15bbe6bd6ac76844edd
parent90009b901856e965f4064afe8ed7e277aa96d93a
scsi: core: Reallocate device's budget map on queue depth change

We currently use ->cmd_per_lun as initial queue depth for setting up the
budget_map. Martin Wilck reported that it is common for the queue_depth to
be subsequently updated in slave_configure() based on detected hardware
characteristics.

As a result, for some drivers, the static host template settings for
cmd_per_lun and can_queue won't actually get used in practice. And if the
default values are used to allocate the budget_map, memory may be consumed
unnecessarily.

Fix the issue by reallocating the budget_map after ->slave_configure()
returns. At that time the device queue_depth should accurately reflect what
the hardware needs.

Link: https://lore.kernel.org/r/20220127153733.409132-1-ming.lei@redhat.com
Cc: Bart Van Assche <bvanassche@acm.org>
Reported-by: Martin Wilck <martin.wilck@suse.com>
Suggested-by: Martin Wilck <martin.wilck@suse.com>
Tested-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_scan.c