aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2009-09-17 14:48:21 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-01 15:15:44 -0400
commit3ff1111dc6e27524eeef267ab0ca9b5690594748 (patch)
tree200b62231c3c266ea3366c8200403c946c9dc481
parentfa52bec9df974096f9eb0e42a0b890512c0a0036 (diff)
cciss: Add a "raid_level" attribute to each logical drive in /sys
and change get rid of some magic numbers in raid lavel decoding. Add raid_level attribute to each logical drive at /sys/devices/<dev>/ccissX/cXdY/raid_level for controller X, logical drive Y Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--Documentation/ABI/testing/sysfs-bus-pci-devices-cciss7
-rw-r--r--drivers/block/cciss.c24
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
45Contact: iss_storagedev@hp.com 45Contact: iss_storagedev@hp.com
46Description: Displays the 8-byte LUN ID used to address logical 46Description: Displays the 8-byte LUN ID used to address logical
47 drive Y of controller X. 47 drive Y of controller X.
48
49Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level
50Date: August 2009
51Kernel Version: 2.6.31
52Contact: iss_storagedev@hp.com
53Description: 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}
604DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); 604DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL);
605 605
606static 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}
627DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL);
628
606static struct attribute *cciss_host_attrs[] = { 629static 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