diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2009-09-17 13:48:21 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-01 21:15:44 +0200 |
commit | 3ff1111dc6e27524eeef267ab0ca9b5690594748 (patch) | |
tree | 200b62231c3c266ea3366c8200403c946c9dc481 /drivers/block | |
parent | fa52bec9df974096f9eb0e42a0b890512c0a0036 (diff) | |
download | blackbird-op-linux-3ff1111dc6e27524eeef267ab0ca9b5690594748.tar.gz blackbird-op-linux-3ff1111dc6e27524eeef267ab0ca9b5690594748.zip |
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>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 24 |
1 files changed, 24 insertions, 0 deletions
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, } DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); +static ssize_t cciss_show_raid_level(struct device *dev, + struct device_attribute *attr, char *buf) +{ + drive_info_struct *drv = dev_get_drvdata(dev); + struct ctlr_info *h = to_hba(drv->dev->parent); + int raid; + unsigned long flags; + + spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); + if (h->busy_configuring) { + spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); + return -EBUSY; + } + raid = drv->raid_level; + spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); + if (raid < 0 || raid > RAID_UNKNOWN) + raid = RAID_UNKNOWN; + + return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n", + raid_label[raid]); +} +DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); + static struct attribute *cciss_host_attrs[] = { &dev_attr_rescan.attr, NULL @@ -629,6 +652,7 @@ static struct attribute *cciss_dev_attrs[] = { &dev_attr_vendor.attr, &dev_attr_rev.attr, &dev_attr_lunid.attr, + &dev_attr_raid_level.attr, NULL }; |