linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: dm-devel@redhat.com
Cc: linux-raid@vger.kernel.org
Subject: [PATCH 12/12] dm-raid456: add message handler.
Date: Thu, 15 Apr 2010 16:43:02 +1000	[thread overview]
Message-ID: <20100415064302.15646.93062.stgit@notabene.brown> (raw)
In-Reply-To: <20100415062909.15646.16.stgit@notabene.brown>

Support messages to:
 - change the size of the stripe cache
 - change the speed limiter on resync.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 drivers/md/dm-raid456.c |   26 ++++++++++++++++++++++++++
 drivers/md/raid5.c      |    3 ++-
 drivers/md/raid5.h      |    1 +
 3 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm-raid456.c b/drivers/md/dm-raid456.c
index 126042d..62c2807 100644
--- a/drivers/md/dm-raid456.c
+++ b/drivers/md/dm-raid456.c
@@ -478,6 +478,31 @@ static void raid_resume(struct dm_target *ti)
 	mddev_resume(&rs->md);
 }
 
+/* Parse and handle a message from userspace
+ * Messages are:
+ *    stripecache  N  (pages per devices)
+ *    minspeed  N          (kibibytes per seconds)
+ */
+static int raid_message(struct dm_target *ti, unsigned argc, char **argv)
+{
+	struct raid_set *rs = ti->private;
+
+	if (argc == 2 && strcmp(argv[0], "stripecache") == 0) {
+		unsigned long size;
+		if (strict_strtoul(argv[1], 10, &size))
+			return -EINVAL;
+		return raid5_set_cache_size(&rs->md, size);
+	}
+	if (argc == 2 && strcmp(argv[0], "minspeed") == 0) {
+		unsigned long speed;
+		if (strict_strtoul(argv[1], 10, &speed))
+			return -EINVAL;
+		rs->md.sync_speed_min = speed;
+		return 0;
+	}
+	return -EINVAL;
+}
+
 static struct target_type raid_target = {
 	.name = "raid45",
 	.version = {1, 0, 0},
@@ -490,6 +515,7 @@ static struct target_type raid_target = {
 	.io_hints = raid_io_hints,
 	.presuspend = raid_presuspend,
 	.resume = raid_resume,
+	.message = raid_message,
 };
 
 static int __init dm_raid_init(void)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 138f65f..805f229 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4503,7 +4503,7 @@ raid5_show_stripe_cache_size(mddev_t *mddev, char *page)
 		return 0;
 }
 
-static int
+int
 raid5_set_cache_size(mddev_t *mddev, int size)
 {
 	raid5_conf_t *conf = mddev->private;
@@ -4527,6 +4527,7 @@ raid5_set_cache_size(mddev_t *mddev, int size)
 	}
 	return 0;
 }
+EXPORT_SYMBOL(raid5_set_cache_size);
 
 static ssize_t
 raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 69dfe39..a08c71b 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -502,4 +502,5 @@ static inline int algorithm_is_DDF(int layout)
 }
 extern int md_raid5_congested(mddev_t *mddev, int bits);
 extern void raid5_unplug_device(raid5_conf_t *conf);
+extern int raid5_set_cache_size(mddev_t *mddev, int size);
 #endif



  parent reply	other threads:[~2010-04-15  6:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15  6:43 [PATCH 00/12] A dm-raid45 target implemented using md raid5 NeilBrown
2010-04-15  6:43 ` [PATCH 01/12] md: reduce dependence on sysfs NeilBrown
2010-04-15  6:43 ` [PATCH 07/12] md/raid5: add simple plugging infrastructure NeilBrown
2010-04-15  6:43 ` [PATCH 08/12] md/plug: optionally use plugger to unplug an array during resync/recovery NeilBrown
2010-04-15  6:43 ` [PATCH 09/12] dm-raid456: support unplug NeilBrown
2010-04-15  6:43 ` [PATCH 11/12] dm-raid456: add suspend/resume method NeilBrown
2010-04-15  6:43 ` [PATCH 03/12] md/dm: create dm-raid456 module using md/raid5 NeilBrown
2010-04-15  6:43 ` [PATCH 05/12] raid5: Don't set read-ahead when there is no queue NeilBrown
2010-04-15  6:43 ` NeilBrown [this message]
2010-04-15  6:43 ` [PATCH 06/12] dm-raid456: add congestion checking NeilBrown
2010-04-15  6:43 ` [PATCH 02/12] md/raid5: factor out code for changing size of stripe cache NeilBrown
2010-04-15  6:43 ` [PATCH 10/12] dm-raid456: add support for setting IO hints NeilBrown
2010-04-15  6:43 ` [PATCH 04/12] dm-raid456: add support for raising events to userspace NeilBrown
2010-04-15  8:52 ` [PATCH 00/12] A dm-raid45 target implemented using md raid5 Jeff Garzik
2010-04-15 17:27 ` [dm-devel] " Heinz Mauelshagen
2010-04-15 22:14   ` Neil Brown
2010-04-16  9:27     ` Heinz Mauelshagen

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=20100415064302.15646.93062.stgit@notabene.brown \
    --to=neilb@suse.de \
    --cc=dm-devel@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    /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).