Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] Expose the degraded status of an assembled array through sysfs
@ 2007-09-10 16:51 Iustin Pop
  2007-10-10  6:31 ` Iustin Pop
  0 siblings, 1 reply; 3+ messages in thread
From: Iustin Pop @ 2007-09-10 16:51 UTC (permalink / raw)
  To: linux-raid

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>
---
Note: I sent this back in January and it people agreed it was a good
idea.  However, it has not been picked up. So here I resend it again.

Patch is against 2.6.23-rc5

Thanks,
Iustin Pop

 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 f883b7e..3e3ad71 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2842,6 +2842,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len)
 static struct md_sysfs_entry md_sync_max =
 __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
 
+static ssize_t
+degraded_show(mddev_t *mddev, char *page)
+{
+	return sprintf(page, "%i\n", mddev->degraded);
+}
+static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
 
 static ssize_t
 sync_speed_show(mddev_t *mddev, char *page)
@@ -2985,6 +2991,7 @@ static struct attribute *md_redundancy_attrs[] = {
 	&md_suspend_lo.attr,
 	&md_suspend_hi.attr,
 	&md_bitmap.attr,
+	&md_degraded.attr,
 	NULL,
 };
 static struct attribute_group md_redundancy_group = {
-- 
1.5.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Expose the degraded status of an assembled array through sysfs
  2007-09-10 16:51 [PATCH] Expose the degraded status of an assembled array through sysfs Iustin Pop
@ 2007-10-10  6:31 ` Iustin Pop
  2007-10-12  2:20   ` Neil Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Iustin Pop @ 2007-10-10  6:31 UTC (permalink / raw)
  To: linux-raid; +Cc: Neil Brown

On Mon, Sep 10, 2007 at 06:51:14PM +0200, Iustin Pop wrote:
> 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>
> ---
> Note: I sent this back in January and it people agreed it was a good
> idea.  However, it has not been picked up. So here I resend it again.

Ping? Neil, could you spare a few moments to look at this? (and sorry for
bothering you)

> 
> Patch is against 2.6.23-rc5
> 
> Thanks,
> Iustin Pop
> 
>  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 f883b7e..3e3ad71 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -2842,6 +2842,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len)
>  static struct md_sysfs_entry md_sync_max =
>  __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
>  
> +static ssize_t
> +degraded_show(mddev_t *mddev, char *page)
> +{
> +	return sprintf(page, "%i\n", mddev->degraded);
> +}
> +static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
>  
>  static ssize_t
>  sync_speed_show(mddev_t *mddev, char *page)
> @@ -2985,6 +2991,7 @@ static struct attribute *md_redundancy_attrs[] = {
>  	&md_suspend_lo.attr,
>  	&md_suspend_hi.attr,
>  	&md_bitmap.attr,
> +	&md_degraded.attr,
>  	NULL,
>  };
>  static struct attribute_group md_redundancy_group = {
> -- 
> 1.5.3.1
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Expose the degraded status of an assembled array through sysfs
  2007-10-10  6:31 ` Iustin Pop
@ 2007-10-12  2:20   ` Neil Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Brown @ 2007-10-12  2:20 UTC (permalink / raw)
  To: Iustin Pop; +Cc: linux-raid

On Wednesday October 10, iusty@k1024.org wrote:
> On Mon, Sep 10, 2007 at 06:51:14PM +0200, Iustin Pop wrote:
> > 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>
> > ---
> > Note: I sent this back in January and it people agreed it was a good
> > idea.  However, it has not been picked up. So here I resend it again.
> 
> Ping? Neil, could you spare a few moments to look at this? (and sorry for
> bothering you)

Yeh.... thanks for your patience.  September was not a good time for
getting my attention.

Yes, I think this is both sensible and useful.

I might just change......

> > @@ -2842,6 +2842,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len)
> >  static struct md_sysfs_entry md_sync_max =
> >  __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
> >  
> > +static ssize_t
> > +degraded_show(mddev_t *mddev, char *page)
> > +{
> > +	return sprintf(page, "%i\n", mddev->degraded);
> > +}

... the %i to a %d though.   At first I thought it was a typo, but
then checked the man page and discovered that %d and %i both mean the
same thing (so why support them both I wonder).

Thanks,
NeilBrown

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-12  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 16:51 [PATCH] Expose the degraded status of an assembled array through sysfs Iustin Pop
2007-10-10  6:31 ` Iustin Pop
2007-10-12  2:20   ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox