linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Clements <paul.clements@steeleye.com>
To: Neil Brown <neilb@suse.de>
Cc: Linux Raid <linux-raid@vger.kernel.org>
Subject: [PATCH 1/1] md: expose behind writes counter
Date: Mon, 14 Dec 2009 11:56:32 -0500	[thread overview]
Message-ID: <4B266E40.4080202@steeleye.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

This is a very simple patch that exposes the behind_writes counter of an 
md array via a sysfs entry. This is helpful when tuning the value of 
behind_writes. Knowing, for instance, the maximum value over time allows 
one to set a proper upper value for an array.

Tested against 2.6.32-rc5 (and 2.6.18).

Thanks,
Paul

[-- Attachment #2: md_expose_behind_writes.diff --]
[-- Type: text/x-diff, Size: 1409 bytes --]

This is a very simple patch that exposes the behind_writes counter of an md
array via a sysfs entry. This is helpful when tuning the value of behind_writes.
Knowing, for instance, the maximum value over time allows one to set a
proper upper value for the array.

Tested against 2.6.32-rc5 (and 2.6.18).

Signed-off-by: Paul Clements <paul.clements@steeleye.com>
---

 md.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff -pur linux-2.6.32-rc5-PRISTINE/drivers/md/md.c linux-2.6.32-rc5/drivers/md/md.c
--- linux-2.6.32-rc5-PRISTINE/drivers/md/md.c	2009-10-15 20:41:50.000000000 -0400
+++ linux-2.6.32-rc5/drivers/md/md.c	2009-10-30 11:00:24.000000000 -0400
@@ -3237,6 +3237,20 @@ static struct md_sysfs_entry md_bitmap =
 __ATTR(bitmap_set_bits, S_IWUSR, null_show, bitmap_store);
 
 static ssize_t
+behind_writes_show(mddev_t *mddev, char *page)
+{
+	if (mddev->bitmap) {
+		return sprintf(page, "%lu\n",
+			atomic_read(&mddev->bitmap->behind_writes));
+	} else {
+		return sprintf(page, "0\n");
+	}
+}
+
+static struct md_sysfs_entry md_behind_writes =
+__ATTR(behind_writes, S_IRUGO, behind_writes_show, NULL);
+
+static ssize_t
 size_show(mddev_t *mddev, char *page)
 {
 	return sprintf(page, "%llu\n",
@@ -3785,6 +3799,7 @@ static struct attribute *md_redundancy_a
 	&md_suspend_lo.attr,
 	&md_suspend_hi.attr,
 	&md_bitmap.attr,
+	&md_behind_writes.attr,
 	&md_degraded.attr,
 	NULL,
 };

             reply	other threads:[~2009-12-14 16:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14 16:56 Paul Clements [this message]
2009-12-14 21:32 ` [PATCH 1/1] md: expose behind writes counter Neil Brown
2009-12-17 22:08   ` Paul Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B266E40.4080202@steeleye.com \
    --to=paul.clements@steeleye.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).