diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-pci-devices-cciss | 7 | ||||
-rw-r--r-- | drivers/block/cciss.c | 20 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss index 8d0260256168..4f29e5f1ebfa 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss | |||
@@ -52,3 +52,10 @@ Kernel Version: 2.6.31 | |||
52 | Contact: iss_storagedev@hp.com | 52 | Contact: iss_storagedev@hp.com |
53 | Description: Displays the RAID level of logical drive Y of | 53 | Description: Displays the RAID level of logical drive Y of |
54 | controller X. | 54 | controller X. |
55 | |||
56 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count | ||
57 | Date: August 2009 | ||
58 | Kernel Version: 2.6.31 | ||
59 | Contact: iss_storagedev@hp.com | ||
60 | Description: Displays the usage count (number of opens) of logical drive Y | ||
61 | of controller X. | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 063e8b0834da..b808e9287b73 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -626,6 +626,25 @@ static ssize_t cciss_show_raid_level(struct device *dev, | |||
626 | } | 626 | } |
627 | DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); | 627 | DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); |
628 | 628 | ||
629 | static ssize_t cciss_show_usage_count(struct device *dev, | ||
630 | struct device_attribute *attr, char *buf) | ||
631 | { | ||
632 | drive_info_struct *drv = dev_get_drvdata(dev); | ||
633 | struct ctlr_info *h = to_hba(drv->dev->parent); | ||
634 | unsigned long flags; | ||
635 | int count; | ||
636 | |||
637 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); | ||
638 | if (h->busy_configuring) { | ||
639 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | ||
640 | return -EBUSY; | ||
641 | } | ||
642 | count = drv->usage_count; | ||
643 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | ||
644 | return snprintf(buf, 20, "%d\n", count); | ||
645 | } | ||
646 | DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL); | ||
647 | |||
629 | static struct attribute *cciss_host_attrs[] = { | 648 | static struct attribute *cciss_host_attrs[] = { |
630 | &dev_attr_rescan.attr, | 649 | &dev_attr_rescan.attr, |
631 | NULL | 650 | NULL |
@@ -653,6 +672,7 @@ static struct attribute *cciss_dev_attrs[] = { | |||
653 | &dev_attr_rev.attr, | 672 | &dev_attr_rev.attr, |
654 | &dev_attr_lunid.attr, | 673 | &dev_attr_lunid.attr, |
655 | &dev_attr_raid_level.attr, | 674 | &dev_attr_raid_level.attr, |
675 | &dev_attr_usage_count.attr, | ||
656 | NULL | 676 | NULL |
657 | }; | 677 | }; |
658 | 678 | ||