From patchwork Tue Jun 1 09:56:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 103512 X-Patchwork-Delegate: jbrassow@redhat.com Received: from mx01.colomx.prod.int.phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o51CQ30M006446 for ; Tue, 1 Jun 2010 12:26:39 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o51COaXL017008; Tue, 1 Jun 2010 08:24:36 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o51A0cXu002787 for ; Tue, 1 Jun 2010 06:00:38 -0400 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.5]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o51A0UAN002541; Tue, 1 Jun 2010 06:00:30 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o51A0HqU008219; Tue, 1 Jun 2010 06:00:18 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id AE7AF8AC33; Tue, 1 Jun 2010 12:00:17 +0200 (CEST) From: NeilBrown To: Heinz Mauelshagen , Alasdair G Kergon Date: Tue, 01 Jun 2010 19:56:20 +1000 Message-ID: <20100601095620.565.49108.stgit@notabene.brown> In-Reply-To: <20100601094414.565.3638.stgit@notabene.brown> References: <20100601094414.565.3638.stgit@notabene.brown> User-Agent: StGit/0.15 MIME-Version: 1.0 X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.5 X-loop: dm-devel@redhat.com Cc: linux-raid@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 16/24] dm-raid456: add message handler. X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 01 Jun 2010 12:26:39 +0000 (UTC) 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