[dm-devel] [PATCH v2 3/9] libmultipath: alua: try to retrieve inquiry data from sysfs

Martin Wilck mwilck at suse.com
Mon Mar 18 09:47:15 UTC 2019


On Mon, 2019-03-18 at 08:08 +0100, Hannes Reinecke wrote:
> On 3/15/19 6:19 PM, Martin Wilck wrote:
> > This can avoid IO while configuring the path prioritizer.
> > The alua prioritizer avoids reading from sysfs for a reason
> > (see commit 7e2f46d3), but this applies only to RTPG / STPG,
> > not to INQUIRY calls.
> > 
> > Cc: Steve.Schremmer at netapp.com
> > Cc: NetApp RDAC team <ng-eseries-upstream-maintainers at netapp.com>
> > Cc: Hannes Reinecke <hare at suse.com>
> > Signed-off-by: Martin Wilck <mwilck at suse.com>
> > ---
> >   libmultipath/prioritizers/alua_rtpg.c | 17 +++++++++++++++++
> >   1 file changed, 17 insertions(+)
> > 
> > diff --git a/libmultipath/prioritizers/alua_rtpg.c
> > b/libmultipath/prioritizers/alua_rtpg.c
> > index d9215a88..271a019d 100644
> > --- a/libmultipath/prioritizers/alua_rtpg.c
> > +++ b/libmultipath/prioritizers/alua_rtpg.c
> > @@ -188,6 +188,23 @@ retry:
> >   int do_inquiry(const struct path *pp, int evpd, unsigned int
> > codepage,
> >   	       void *resp, int resplen, unsigned int timeout)
> >   {
> > +	struct udev_device *ud;
> > +
> > +	ud = udev_device_get_parent_with_subsystem_devtype(pp->udev,
> > "scsi",
> > +							   "scsi_device
> > ");
> > +	if (ud != NULL) {
> > +		int rc;
> > +
> > +		if (!evpd)
> > +			rc = sysfs_get_inquiry(ud, resp, resplen);
> > +		else
> > +			rc = sysfs_get_vpd(ud, codepage, resp,
> > resplen);
> > +
> > +		if (rc >= 0) {
> > +			PRINT_HEX((unsigned char *) resp, resplen);
> > +			return 0;
> > +		}
> > +	}
> >   	return do_inquiry_sg(pp->fd, evpd, codepage, resp, resplen,
> > timeout);
> >   }
> >   
> > 
> Don't you need to do a udev_device_put() or somesuch?

No. The man page of udev_device_get_parent... says "No additional
reference to this device is acquired".

Thanks,
Martin


> 
> Other than that:
> 
> Reviewed-by: Hannes Reinecke <hare at suse.com>
> 
> Cheers,
> 
> Hannes

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)





More information about the dm-devel mailing list