From: Mike Christie <michael.christie@oracle.com>
To: Bart Van Assche <bvanassche@acm.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.de>,
John Garry <john.garry@huawei.com>
Subject: Re: [PATCH v2 2/2] scsi: core: Introduce a new list for SCSI proc directory entries
Date: Thu, 8 Sep 2022 11:03:01 -0500 [thread overview]
Message-ID: <1a530d46-03e3-0ec4-b633-3ebd2297a525@oracle.com> (raw)
In-Reply-To: <20220830210509.1919493-3-bvanassche@acm.org>
On 8/30/22 4:05 PM, Bart Van Assche wrote:
> Instead of using scsi_host_template members to track the SCSI proc
> directory entries, track these entries in a list. This patch changes the
> time needed for looking up the proc dir pointer from O(1) into O(n). I
> think this is acceptable since the number of SCSI host adapter types per
> host is usually small (less than ten).
>
> This patch has been tested by attaching two USB storage devices to a
> qemu host:
>
> }
> @@ -149,15 +214,17 @@ void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
> void scsi_proc_host_add(struct Scsi_Host *shost)
> {
> struct scsi_host_template *sht = shost->hostt;
> + struct scsi_proc_entry *e;
> struct proc_dir_entry *p;
> char name[10];
>
> - if (!sht->proc_dir)
> */
> void scsi_proc_host_rm(struct Scsi_Host *shost)
> {
> + struct scsi_proc_entry *e;
> char name[10];
>
> - if (!shost->hostt->proc_dir)
Hey Bart, Would it better to replace those two checks with a
if (!sht->show_info)
return;
like is done in scsi_proc_hostdir_add/scsi_proc_hostdir_rm? In those
hostdir functions if show_info is not set, you will not add an entry to
scsi_proc_list. So in the above functions if that callout is not set
you know there is no entry on &scsi_proc_list and don't need to grab the
global_host_template_mutex for those cases.
I can't really test but someone did say they had 1000s of scsi_hosts for
iscsi. I'm not really sure how big a deal it is since we wouldn't be
doing a lot of work with that mutex hold, but it seems like a simple and
nice change just in case.
next prev parent reply other threads:[~2022-09-08 16:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 21:05 [PATCH v2 0/2] Prepare for constifying SCSI host templates Bart Van Assche
2022-08-30 21:05 ` [PATCH v2 1/2] scsi: esas2r: Introduce scsi_template_proc_dir() Bart Van Assche
2022-08-30 21:05 ` [PATCH v2 2/2] scsi: core: Introduce a new list for SCSI proc directory entries Bart Van Assche
2022-09-08 16:03 ` Mike Christie [this message]
2022-09-08 16:48 ` Bart Van Assche
2022-09-01 14:23 ` [PATCH v2 0/2] Prepare for constifying SCSI host templates John Garry
2022-09-08 15:04 ` Krzysztof Kozlowski
2022-09-08 16:50 ` Bart Van Assche
2022-09-08 20:11 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a530d46-03e3-0ec4-b633-3ebd2297a525@oracle.com \
--to=michael.christie@oracle.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.garry@huawei.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).