Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   dm-raid456: add message handler. (http://www.linux-archive.org/device-mapper-development/357197-dm-raid456-add-message-handler.html)

NeilBrown 04-15-2010 06:43 AM

dm-raid456: add message handler.
 
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


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

NeilBrown 06-01-2010 09:56 AM

dm-raid456: add message handler.
 
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 044faae..3fda954 100644
--- a/drivers/md/dm-raid456.c
+++ b/drivers/md/dm-raid456.c
@@ -485,6 +485,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},
@@ -498,6 +523,7 @@ static struct target_type raid_target = {
.presuspend = raid_presuspend,
.postsuspend = raid_postsuspend,
.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 be5cab8..8ac122d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4500,7 +4500,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;
@@ -4524,6 +4524,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 fa3938a..292a9c6 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


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

NeilBrown 07-26-2010 03:24 AM

dm-raid456: add message handler.
 
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 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/md/dm-raid456.c b/drivers/md/dm-raid456.c
index e2546fc..a2567b0 100644
--- a/drivers/md/dm-raid456.c
+++ b/drivers/md/dm-raid456.c
@@ -485,6 +485,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},
@@ -498,6 +523,7 @@ static struct target_type raid_target = {
.presuspend = raid_presuspend,
.postsuspend = raid_postsuspend,
.resume = raid_resume,
+ .message = raid_message,
};

static int __init dm_raid_init(void)


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


All times are GMT. The time now is 02:31 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.