diff options
author | Iustin Pop <iusty@k1024.org> | 2007-10-17 02:30:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:43:03 -0400 |
commit | d7f3d291a0e1330f341fdf1128b2d12fff7932ee (patch) | |
tree | c7dd6ab8ece277fe71c9626aeeda2e79dd259476 /drivers/md | |
parent | 2b12ab6d33f413aabb623197eeecaad5c216e6ae (diff) |
md: expose the degraded status of an assembled array through sysfs
The 'degraded' attribute is useful to quickly determine if the array is
degraded, instead of parsing 'mdadm -D' output or relying on the other
techniques (number of working devices against number of defined devices,
etc.). The md code already keeps track of this attribute, so it's useful to
export it.
Signed-off-by: Iustin Pop <iusty@k1024.org>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 510625e3a965..c059ae6f37e5 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2833,6 +2833,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len) | |||
2833 | static struct md_sysfs_entry md_sync_max = | 2833 | static struct md_sysfs_entry md_sync_max = |
2834 | __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); | 2834 | __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); |
2835 | 2835 | ||
2836 | static ssize_t | ||
2837 | degraded_show(mddev_t *mddev, char *page) | ||
2838 | { | ||
2839 | return sprintf(page, "%d\n", mddev->degraded); | ||
2840 | } | ||
2841 | static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); | ||
2836 | 2842 | ||
2837 | static ssize_t | 2843 | static ssize_t |
2838 | sync_speed_show(mddev_t *mddev, char *page) | 2844 | sync_speed_show(mddev_t *mddev, char *page) |
@@ -2976,6 +2982,7 @@ static struct attribute *md_redundancy_attrs[] = { | |||
2976 | &md_suspend_lo.attr, | 2982 | &md_suspend_lo.attr, |
2977 | &md_suspend_hi.attr, | 2983 | &md_suspend_hi.attr, |
2978 | &md_bitmap.attr, | 2984 | &md_bitmap.attr, |
2985 | &md_degraded.attr, | ||
2979 | NULL, | 2986 | NULL, |
2980 | }; | 2987 | }; |
2981 | static struct attribute_group md_redundancy_group = { | 2988 | static struct attribute_group md_redundancy_group = { |