dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Brian Bunker <brian@purestorage.com>
To: Steffen Maier <maier@linux.ibm.com>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: Re: Make LUNs higher than 255 more friendly to look at
Date: Fri, 25 Sep 2020 09:10:10 -0700	[thread overview]
Message-ID: <6D530ACA-1C7F-4AA4-BD18-9DD7B429920B@purestorage.com> (raw)
In-Reply-To: <495bf574-1f2f-a281-96e5-c7631b0f07f0@linux.ibm.com>

I am not suggesting changing the the LUN value itself, only to print it in a way that make more sense with
what the user would expect. I am open to sharpening the check if you are worried about LUN addressing
different than peripheral and flat, but I think that this is arguably better than what shows without it.

Here is an example, the user has connected LUNs up to 256. I am including just LUNs 255 and 256 to
show what I mean:

root@c106-18-ct0:~# purevol connect target1 --host init106-18 --lun 255
Name     Host Group  Host        LUN
target1  -                     init106-18  255
root@c106-18-ct0:~# purevol connect validation1 --host init106-18 --lun 256
Name         Host Group  Host        LUN
validation1  -                   init106-18  256

What does multipath -ll show?

[root@init106-18 multipath-tools-0.8.3]# multipath -ll
3624a9370385e6cda676493f900011014 dm-0 PURE,FlashArray
size=500G features='0' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 6:0:0:255   sdd 8:48  active ready running
  |- 7:0:0:255   sdg 8:96  active ready running
  |- 8:0:0:255   sdb 8:16  active ready running
  `- 9:0:0:255   sdc 8:32  active ready running
3624a9370385e6cda676493f900011013 dm-1 PURE,FlashArray
size=500G features='0' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 6:0:0:16640 sde 8:64  active ready running
  |- 7:0:0:16640 sdh 8:112 active ready running
  |- 8:0:0:16640 sdi 8:128 active ready running
  `- 9:0:0:16640 sdj 8:144 active ready running

So what you can see is that it is already confusing to the user. The first 255 LUNs are in peripheral
addressing mode but when you get to LUN 256 then it moves into flat address space. What I expect the
user would expect if they didn’t understand the shift would be 255 and 256.

My change makes this into:
[root@init106-18 multipath-tools-0.8.3]# multipath -ll
3624a9370385e6cda676493f900011014 dm-0 PURE,FlashArray
size=500G features='0' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 6:0:0:255 sdd 8:48  active ready running
  |- 7:0:0:255 sdg 8:96  active ready running
  |- 8:0:0:255 sdb 8:16  active ready running
  `- 9:0:0:255 sdc 8:32  active ready running
3624a9370385e6cda676493f900011013 dm-1 PURE,FlashArray
size=500G features='0' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 6:0:0:256 sde 8:64  active ready running
  |- 7:0:0:256 sdh 8:112 active ready running
  |- 8:0:0:256 sdi 8:128 active ready running
  `- 9:0:0:256 sdj 8:144 active ready running

Thanks,
Brian

Brian Bunker
SW Eng
brian@purestorage.com



> On Sep 25, 2020, at 7:14 AM, Steffen Maier <maier@linux.ibm.com> wrote:
> 
> Hi Brian,
> 
> On 9/24/20 11:10 PM, Brian Bunker wrote:
>> For LUNs between 0 and 255 peripheral addressing is used. For LUNs higher than 255 the LUN addressing
>> should switch to flat according to the specification. Instead of printing out the LUN number without regard to
>> the shifting of address method, display the LUN as it was intended to be the user connecting the LUN. The
>> current display leaves a non-obvious 16384 offset.
>> In short, a LUN connected as 258 will show up in multipath output as 16642. Instead display it as the
>> expected 258. This is for display only and doesn’t change the actual contents of the LUN variable.
>> Signed-off-by: Brian Bunker <brian@purestorage.com>
>> ___
>> --- a/libmultipath/print.c      2020-09-24 13:52:18.661828011 -0600
>> +++ b/libmultipath/print.c      2020-09-24 14:28:27.603542303 -0600
>> @@ -394,7 +394,7 @@
>>                         pp->sg_id.host_no,
>>                         pp->sg_id.channel,
>>                         pp->sg_id.scsi_id,
>> -                       pp->sg_id.lun);
>> +                       (pp->sg_id.lun & 0x4000) ? pp->sg_id.lun - 0x4000 : pp->sg_id.lun);
>>  }
>>  static int
> 
> For Linux SCSI devices, and if I understood the code correctly [libmultipath/discovery.c:scsi_sysfs_pathinfo()], this seems the SCSI LUN value being part of the SCSI device name in its H:C:T:L format. AFAIK, Linux intentionally treats this as an opaque 64-bit value to reflect a T10 SAM LUN [as decimal number with reversed LUN levels, though, so a peripheral addressing LUN happens to look like a small integer value]. This way, it always works with any (current or future) LUN format and its potentially different LUN format fields/parts.
> 
> Users may use the hcil output to find the corresponding Linux SCSI device by its name. Would this still work if the output value was modified?
> 
> Also, some (FCP-attached SCSI) storages in particular cases use LUN format fields in addition to "... LUN" to code a larger somewhat opaque 64-bit T10 SAM LUN value. For instance "BUS IDENTIFIER" with peripheral addressing, or a non-zero 2nd level with flat space addressing. Above conversion seems to at least result in unexpected values.
> 
> ((Not sure for this case, as NVMe might use its own print output code in libmultipath/foreign/nvme.c: nvme_sysfs_pathinfo() seems to be another user assigning a non-zero value to sg_id.lun [originating in the nsid (namespace-ID?)]. An unconditional value conversion in the output printing code path based on SCSI knowledge might break output of values belonging to NVMe paths.))
> 
> -- 
> Mit freundlichen Gruessen / Kind regards
> Steffen Maier
> 
> Linux on IBM Z Development
> 
> https://www.ibm.com/privacy/us/en/
> IBM Deutschland Research & Development GmbH
> Vorsitzender des Aufsichtsrats: Matthias Hartmann
> Geschaeftsfuehrung: Dirk Wittkopp
> Sitz der Gesellschaft: Boeblingen
> Registergericht: Amtsgericht Stuttgart, HRB 243294


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

  reply	other threads:[~2020-09-25 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 21:10 Make LUNs higher than 255 more friendly to look at Brian Bunker
2020-09-25 14:14 ` Steffen Maier
2020-09-25 16:10   ` Brian Bunker [this message]
2020-09-26  4:23 ` 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=6D530ACA-1C7F-4AA4-BD18-9DD7B429920B@purestorage.com \
    --to=brian@purestorage.com \
    --cc=dm-devel@redhat.com \
    --cc=maier@linux.ibm.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).