diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-pci-devices-cciss | 7 | ||||
-rw-r--r-- | drivers/block/cciss.c | 24 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss index 5a6c8d36afc4..8d0260256168 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss | |||
@@ -45,3 +45,10 @@ Kernel Version: 2.6.31 | |||
45 | Contact: iss_storagedev@hp.com | 45 | Contact: iss_storagedev@hp.com |
46 | Description: Displays the 8-byte LUN ID used to address logical | 46 | Description: Displays the 8-byte LUN ID used to address logical |
47 | drive Y of controller X. | 47 | drive Y of controller X. |
48 | |||
49 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level | ||
50 | Date: August 2009 | ||
51 | Kernel Version: 2.6.31 | ||
52 | Contact: iss_storagedev@hp.com | ||
53 | Description: Displays the RAID level of logical drive Y of | ||
54 | controller X. | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index b674f93d4be8..063e8b0834da 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -603,6 +603,29 @@ static ssize_t cciss_show_lunid(struct device *dev, | |||
603 | } | 603 | } |
604 | DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); | 604 | DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); |
605 | 605 | ||
606 | static ssize_t cciss_show_raid_level(struct device *dev, | ||
607 | struct device_attribute *attr, char *buf) | ||
608 | { | ||
609 | drive_info_struct *drv = dev_get_drvdata(dev); | ||
610 | struct ctlr_info *h = to_hba(drv->dev->parent); | ||
611 | int raid; | ||
612 | unsigned long flags; | ||
613 | |||
614 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); | ||
615 | if (h->busy_configuring) { | ||
616 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | ||
617 | return -EBUSY; | ||
618 | } | ||
619 | raid = drv->raid_level; | ||
620 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | ||
621 | if (raid < 0 || raid > RAID_UNKNOWN) | ||
622 | raid = RAID_UNKNOWN; | ||
623 | |||
624 | return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n", | ||
625 | raid_label[raid]); | ||
626 | } | ||
627 | DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); | ||
628 | |||
606 | static struct attribute *cciss_host_attrs[] = { | 629 | static struct attribute *cciss_host_attrs[] = { |
607 | &dev_attr_rescan.attr, | 630 | &dev_attr_rescan.attr, |
608 | NULL | 631 | NULL |
@@ -629,6 +652,7 @@ static struct attribute *cciss_dev_attrs[] = { | |||
629 | &dev_attr_vendor.attr, | 652 | &dev_attr_vendor.attr, |
630 | &dev_attr_rev.attr, | 653 | &dev_attr_rev.attr, |
631 | &dev_attr_lunid.attr, | 654 | &dev_attr_lunid.attr, |
655 | &dev_attr_raid_level.attr, | ||
632 | NULL | 656 | NULL |
633 | }; | 657 | }; |
634 | 658 | ||