Re: [PATCH 1 22/25] hpsa: enhance device messages

2015-11-03 Thread Tomas Henzl
On 2.11.2015 17:54, Don Brace wrote:
> On 10/30/2015 09:32 AM, Tomas Henzl wrote:
>> RAID_UNKNOWN is used in few other places - raid_level_show for example,
> raid_level_show handles physical devices by using "N/A", otherwise it 
> displays
> the RAID level for logical devices.
>
> Other functions avoid the use of raid_type when the drive is not a RAID 
> device.
>
> Or, am I missing your point?

Seems that I missed the fact that raid_level_show output is N/A,
I thought it would be "RAID-Unknown".

Last minor point is that you could replace 
+   dev->raid_level > RAID_UNKNOWN ? "?" :
+   raid_label[dev->raid_level]);
with
+   dev->raid_level > RAID_UNKNOWN ? 
raid_label[RAID_UNKNOWN] :
+   raid_label[dev->raid_level]);
but that's not important.

Reviewed-by: Tomas Henzl 

Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1 22/25] hpsa: enhance device messages

2015-11-02 Thread Don Brace

On 10/30/2015 09:32 AM, Tomas Henzl wrote:

RAID_UNKNOWN is used in few other places - raid_level_show for example,


raid_level_show handles physical devices by using "N/A", otherwise it 
displays

the RAID level for logical devices.

Other functions avoid the use of raid_type when the drive is not a RAID 
device.


Or, am I missing your point?

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1 22/25] hpsa: enhance device messages

2015-10-30 Thread Hannes Reinecke
On 10/28/2015 11:06 PM, Don Brace wrote:
> Reviewed-by: Justin Lindley 
> Reviewed-by: Scott Teel 
> Reviewed-by: Kevin Barnett 
> Signed-off-by: Don Brace 
> ---
>  drivers/scsi/hpsa.c |   45 -
>  1 file changed, 40 insertions(+), 5 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1 22/25] hpsa: enhance device messages

2015-10-30 Thread Tomas Henzl
On 28.10.2015 23:06, Don Brace wrote:
> Reviewed-by: Justin Lindley 
> Reviewed-by: Scott Teel 
> Reviewed-by: Kevin Barnett 
> Signed-off-by: Don Brace 
> ---
>  drivers/scsi/hpsa.c |   45 -
>  1 file changed, 40 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 33fd0aa..b2418c3 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -609,7 +609,7 @@ static inline int is_logical_dev_addr_mode(unsigned char 
> scsi3addr[])
>  }
>  
>  static const char * const raid_label[] = { "0", "4", "1(+0)", "5", "5+1", 
> "6",
> - "1(+0)ADM", "UNKNOWN"
> + "1(+0)ADM", "UNKNOWN", "PHYS DRV"
>  };
>  #define HPSA_RAID_0  0
>  #define HPSA_RAID_4  1
> @@ -618,7 +618,8 @@ static const char * const raid_label[] = { "0", "4", 
> "1(+0)", "5", "5+1", "6",
>  #define HPSA_RAID_51 4
>  #define HPSA_RAID_6  5   /* also used for RAID 60 */
>  #define HPSA_RAID_ADM6   /* also used for RAID 1+0 ADM */
> -#define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 1)
> +#define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 2)
> +#define PHYSICAL_DRIVE (ARRAY_SIZE(raid_label) - 1)

RAID_UNKNOWN is used in few other places - raid_level_show for example,
shouldn't be that also adapted?

-tm

> /
>  
>  static inline bool is_logical_device(struct hpsa_scsi_dev_t *device)
>  {
> @@ -1144,21 +1145,55 @@ static int hpsa_find_target_lun(struct ctlr_info *h,
>  static void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
>   struct hpsa_scsi_dev_t *dev, char *description)
>  {
> +#define LABEL_SIZE 25
> + char label[LABEL_SIZE];
> +
>   if (dev == NULL)
>   return;
>  
>   if (h == NULL || h->pdev == NULL || h->scsi_host == NULL)
>   return;
>  
> + switch (dev->devtype) {
> + case TYPE_RAID:
> + snprintf(label, LABEL_SIZE, "controller");
> + break;
> + case TYPE_ENCLOSURE:
> + snprintf(label, LABEL_SIZE, "enclosure");
> + break;
> + case TYPE_DISK:
> + if (dev->external)
> + snprintf(label, LABEL_SIZE, "external");
> + else if (!is_logical_dev_addr_mode(dev->scsi3addr))
> + snprintf(label, LABEL_SIZE, "%s",
> + raid_label[PHYSICAL_DRIVE]);
> + else
> + snprintf(label, LABEL_SIZE, "RAID-%s",
> + dev->raid_level > RAID_UNKNOWN ? "?" :
> + raid_label[dev->raid_level]);
> + break;
> + case TYPE_ROM:
> + snprintf(label, LABEL_SIZE, "rom");
> + break;
> + case TYPE_TAPE:
> + snprintf(label, LABEL_SIZE, "tape");
> + break;
> + case TYPE_MEDIUM_CHANGER:
> + snprintf(label, LABEL_SIZE, "changer");
> + break;
> + default:
> + snprintf(label, LABEL_SIZE, "UNKNOWN");
> + break;
> + }
> +
>   dev_printk(level, >pdev->dev,
> - "scsi %d:%d:%d:%d: %s %s %.8s %.16s RAID-%s 
> SSDSmartPathCap%c En%c Exp=%d\n",
> + "scsi %d:%d:%d:%d: %s %s %.8s %.16s %s 
> SSDSmartPathCap%c En%c Exp=%d\n",
>   h->scsi_host->host_no, dev->bus, dev->target, dev->lun,
>   description,
>   scsi_device_type(dev->devtype),
>   dev->vendor,
>   dev->model,
> - dev->raid_level > RAID_UNKNOWN ?
> - "RAID-?" : raid_label[dev->raid_level],
> + label,
>   dev->offload_config ? '+' : '-',
>   dev->offload_enabled ? '+' : '-',
>   dev->expose_device);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1 22/25] hpsa: enhance device messages

2015-10-30 Thread Matthew R. Ochs
Reviewed-by: Matthew R. Ochs 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html