scsi: core: Introduce a new list for SCSI proc directory entries
Instead of using scsi_host_template members to track the SCSI proc directory entries, track these entries in a list. This changes the time needed for looking up the proc dir pointer from O(1) into O(n). This is considered acceptable since the number of SCSI host adapter types per host is usually small (less than ten). This change has been tested by attaching two USB storage devices to a qemu host: $ grep -aH . /proc/scsi/usb-storage/* /proc/scsi/usb-storage/7: Host scsi7: usb-storage /proc/scsi/usb-storage/7: Vendor: QEMU /proc/scsi/usb-storage/7: Product: QEMU USB HARDDRIVE /proc/scsi/usb-storage/7:Serial Number: 1-0000:00:02.1:00.0-6 /proc/scsi/usb-storage/7: Protocol: Transparent SCSI /proc/scsi/usb-storage/7: Transport: Bulk /proc/scsi/usb-storage/7: Quirks: SANE_SENSE /proc/scsi/usb-storage/8: Host scsi8: usb-storage /proc/scsi/usb-storage/8: Vendor: QEMU /proc/scsi/usb-storage/8: Product: QEMU USB HARDDRIVE /proc/scsi/usb-storage/8:Serial Number: 1-0000:00:02.1:00.0-7 /proc/scsi/usb-storage/8: Protocol: Transparent SCSI /proc/scsi/usb-storage/8: Transport: Bulk /proc/scsi/usb-storage/8: Quirks: SANE_SENSE This commit prepares for constifying most SCSI host templates. Reviewed-by: John Garry <john.garry@huawei.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ming Lei <ming.lei@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Cc: Mike Christie <michael.christie@oracle.com> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20221015002418.30955-5-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
ecca3f9b16
commit
036abd6140
@@ -357,12 +357,6 @@ struct scsi_host_template {
|
||||
*/
|
||||
const char *proc_name;
|
||||
|
||||
/*
|
||||
* Used to store the procfs directory if a driver implements the
|
||||
* show_info method.
|
||||
*/
|
||||
struct proc_dir_entry *proc_dir;
|
||||
|
||||
/*
|
||||
* This determines if we will use a non-interrupt driven
|
||||
* or an interrupt driven scheme. It is set to the maximum number
|
||||
@@ -423,12 +417,6 @@ struct scsi_host_template {
|
||||
*/
|
||||
short cmd_per_lun;
|
||||
|
||||
/*
|
||||
* present contains counter indicating how many boards of this
|
||||
* type were found when we did the scan.
|
||||
*/
|
||||
unsigned char present;
|
||||
|
||||
/* If use block layer to manage tags, this is tag allocation policy */
|
||||
int tag_alloc_policy;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user