From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
linux-scsi@vger.kernel.org,
Vinayak Holikatti <vinholikatti@gmail.com>,
Dolev Raviv <draviv@codeaurora.org>,
Sujit Reddy Thumma <sthumma@codeaurora.org>,
Subhash Jadavani <subhashj@codeaurora.org>,
Christoph Hellwig <hch@lst.de>,
Matthew Dharm <mdharm-usb@one-eyed-alien.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"David S. Miller" <davem@davemloft.net>,
Hannes Reinecke <hare@suse.de>,
linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net
Subject: Re: [PATCH v6 0/4] scsi: ufs & ums-* & esp_scsi: fix module reference counting
Date: Tue, 05 May 2015 14:42:28 -0700 [thread overview]
Message-ID: <1430862148.2173.73.camel@HansenPartnership.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1505051432090.1639-100000@iolanthe.rowland.org>
On Tue, 2015-05-05 at 15:14 -0400, Alan Stern wrote:
> On Tue, 5 May 2015, James Bottomley wrote:
>
> > > The cost is duplication of the .owner field in every Scsi_Host. The
> > > savings is a reduction in the number of scsi_host_templates.
> >
> > So your essential objection is the host template duplication? I know
> > it's a couple of hundred bytes, but surely its dwarfed by all the other
> > stuff you have to duplicate ... the module size of each of these is
> > around 0.25MB, so a couple of hundred bytes would seem a bit
> > insignificant.
>
> Agreed, the size is relatively insignificant. I drop any objection on
> that account. (But turning things around, what's wrong with
> duplicating the .owner field in the Scsi_Host structure when we're
> already duplicating this_id, can_queue, sg_tablesize, and a large bunch
> of others?)
It's really only the pattern wrongness. However, as Rusty says (at
length) the best APIs are those that you can't get wrong and having the
owner in the template gives that (it's a Level 10 interface).
Duplicating the owner in the host gets us to the point where following
convention you get it right but nothing prevents abuse (it's a Level 4
interface). I mean, it could be worse (his scale goes down to -10) but
I'd rather not move down if we don't have to.
> On the other hand, your code to populate the template copies is a mess.
> I like Akinobu's approach much better
Unfortunately with that approach, values in the host template can't be
overridden.
> , although I would change a few
> details:
>
> Declare usb_stor_host_template as "const", and define a new,
> separate usb_stor_template in usb.c for actual use.
>
> In usb_stor_host_template_init(), do a plain structure
> assignment rather than memcpy.
OK, so I'm happy with that: it solves the "can't be overridden" problem
if you mean a driver should
declare a local template
call usb_stor_host_template_init() on the local template
override whatever they want (or nothing)
call usb_stor_probe1 with the new template.
I also note that you can
#define usb_stor_host_template_init(t, n) __usb_stor_host_template_init((t), (n), THIS_MODULE)
And make it just work for normal usage.
James
next prev parent reply other threads:[~2015-05-05 21:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 14:46 [PATCH v6 0/4] scsi: ufs & ums-* & esp_scsi: fix module reference counting Akinobu Mita
2015-05-04 14:46 ` [PATCH v6 1/4] scsi: add ability to adjust module reference for scsi host Akinobu Mita
2015-05-04 14:46 ` [PATCH v6 2/4] scsi: ufs: " Akinobu Mita
[not found] ` <1430750769-11405-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-04 14:46 ` [PATCH v6 3/4] usb: storage: " Akinobu Mita
2015-05-04 14:46 ` [PATCH v6 4/4] scsi: esp_scsi: " Akinobu Mita
2015-05-04 15:15 ` [PATCH v6 0/4] scsi: ufs & ums-* & esp_scsi: fix module reference counting James Bottomley
[not found] ` <1430752523.2177.15.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2015-05-04 15:30 ` Hannes Reinecke
2015-05-04 20:09 ` Alan Stern
2015-05-04 21:41 ` James Bottomley
[not found] ` <1430775664.2177.36.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2015-05-05 13:39 ` Akinobu Mita
2015-05-05 15:35 ` James Bottomley
2015-05-05 14:25 ` Alan Stern
2015-05-05 18:05 ` James Bottomley
2015-05-05 19:14 ` Alan Stern
2015-05-05 21:42 ` James Bottomley [this message]
2015-05-06 9:26 ` Akinobu Mita
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=1430862148.2173.73.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=akinobu.mita@gmail.com \
--cc=davem@davemloft.net \
--cc=draviv@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mdharm-usb@one-eyed-alien.net \
--cc=stern@rowland.harvard.edu \
--cc=sthumma@codeaurora.org \
--cc=subhashj@codeaurora.org \
--cc=usb-storage@lists.one-eyed-alien.net \
--cc=vinholikatti@gmail.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