Re: [PATCH v6 0/4] scsi: ufs & ums-* & esp_scsi: fix module reference counting

Alan Stern
2015-05-05T19:14:37Z

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?)

On the other hand, your code to populate the template copies is a mess.
I like Akinobu's approach much better, 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.

Alan Stern