All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH v5 5/5] target: perform t10_wwn ID initialisation in target_alloc_device()
Date: Sun, 02 Dec 2018 22:22:23 +0000	[thread overview]
Message-ID: <20181202232223.7db5f24e@suse.de> (raw)
In-Reply-To: <20181130233423.26556-6-ddiss@suse.de>

Hi Hannes,

Thanks for the feedback...

On Sat, 1 Dec 2018 15:59:25 +0100, Hannes Reinecke wrote:

> On 12/1/18 12:34 AM, David Disseldorp wrote:
...
> > @@ -810,6 +810,23 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
> >   	mutex_init(&xcopy_lun->lun_tg_pt_md_mutex);
> >   	xcopy_lun->lun_tpg = &xcopy_pt_tpg;
> >   
> > +	/*
> > +	 * Preload the initial INQUIRY const values if we are doing
> > +	 * anything virtual (IBLOCK, FILEIO, RAMDISK), but not for TCM/pSCSI
> > +	 * passthrough because this is being provided by the backend LLD.
> > +	 */
> > +	BUILD_BUG_ON(sizeof(dev->t10_wwn.vendor) != INQUIRY_VENDOR_LEN + 1);
> > +	BUILD_BUG_ON(sizeof(dev->t10_wwn.model) != INQUIRY_MODEL_LEN + 1);
> > +	BUILD_BUG_ON(sizeof(dev->t10_wwn.revision) != INQUIRY_REVISION_LEN + 1);
> > +	if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH)) {
> > +		strlcpy(dev->t10_wwn.vendor, "LIO-ORG",
> > +			sizeof(dev->t10_wwn.vendor));
> > +		strlcpy(dev->t10_wwn.model, dev->transport->inquiry_prod,
> > +			sizeof(dev->t10_wwn.model));
> > +		strlcpy(dev->t10_wwn.revision, dev->transport->inquiry_rev,
> > +			sizeof(dev->t10_wwn.revision));
> > +	}
> > +
> >   	return dev;
> >   }
> >     
> This is odd. I'd rather have it consistent across backends, ie either 
> move the initialisation into the backends, or provide a means to check 
> if the inquiry data has already been pre-filled.
> But this check really is awkward.

Not quite sure I follow here. I could the default setting to the
target_backend_ops.alloc_device() code paths, but I don't think the
duplication would make this much cleaner, if at all.
I can look into this further if you like (target_backend_ops.inquiry_rev
could be dropped that way), but my preference would be to do so as a
follow-up patch-set.

Cheers, David

  parent reply	other threads:[~2018-12-02 22:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-30 23:34 [PATCH v5 5/5] target: perform t10_wwn ID initialisation in target_alloc_device() David Disseldorp
2018-12-01 14:59 ` Hannes Reinecke
2018-12-02 22:22 ` David Disseldorp [this message]
2018-12-03 11:52 ` David Disseldorp
2018-12-04  0:35 ` 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=20181202232223.7db5f24e@suse.de \
    --to=ddiss@suse.de \
    --cc=target-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.