[dm-devel] Make LUNs higher than 255 more friendly to look at

Bart Van Assche bvanassche at acm.org
Sat Sep 26 04:23:25 UTC 2020


On 2020-09-24 14:10, 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 at 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);
>  }

Please introduce a function for converting the LUN number format and
add appropriate comments. An example is available here:
https://github.com/bvanassche/scst/blob/adfc65513915176d9d85a9e9c734d0b298a66991/scst/src/scst_lib.c#L12117

Thanks,

Bart.




More information about the dm-devel mailing list