From: NeilBrown <neilb@suse.de>
To: dm-devel@redhat.com
Cc: linux-raid@vger.kernel.org
Subject: [PATCH 10/12] dm-raid456: add support for setting IO hints.
Date: Thu, 15 Apr 2010 16:43:02 +1000 [thread overview]
Message-ID: <20100415064302.15646.3504.stgit@notabene.brown> (raw)
In-Reply-To: <20100415062909.15646.16.stgit@notabene.brown>
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/dm-raid456.c | 33 +++++++++++++++++++++++++++++++++
drivers/md/raid5.c | 19 ++++++++++---------
2 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/drivers/md/dm-raid456.c b/drivers/md/dm-raid456.c
index d0e44f2..071a8ae 100644
--- a/drivers/md/dm-raid456.c
+++ b/drivers/md/dm-raid456.c
@@ -434,6 +434,37 @@ static int raid_status(struct dm_target *ti, status_type_t type,
return 0;
}
+static int raid_iterate_devices(struct dm_target *ti,
+ iterate_devices_callout_fn fn,
+ void *data)
+{
+ struct raid_set *rs = ti->private;
+ int ret = 0;
+ unsigned i = 0;
+
+ for (i=0; !ret && i < rs->md.raid_disks; i++)
+ if (rs->dev[i].dev)
+ ret = fn(ti,
+ rs->dev[i].dev,
+ rs->dev[i].rdev.data_offset,
+ rs->md.dev_sectors,
+ data);
+
+ return ret;
+}
+
+static void raid_io_hints(struct dm_target *ti,
+ struct queue_limits *limits)
+{
+ struct raid_set *rs = ti->private;
+ unsigned chunk_size = rs->md.chunk_sectors << 9;
+ raid5_conf_t *conf = rs->md.private;
+
+ blk_limits_io_min(limits, chunk_size);
+ blk_limits_io_opt(limits, chunk_size *
+ (conf->raid_disks - conf->max_degraded));
+}
+
static struct target_type raid_target = {
.name = "raid45",
.version = {1, 0, 0},
@@ -442,6 +473,8 @@ static struct target_type raid_target = {
.dtr = raid_dtr,
.map = raid_map,
.status = raid_status,
+ .iterate_devices = raid_iterate_devices,
+ .io_hints = raid_io_hints,
};
static int __init dm_raid_init(void)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 41a905b..138f65f 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4906,7 +4906,7 @@ static int only_parity(int raid_disk, int algo, int raid_disks, int max_degraded
static int run(mddev_t *mddev)
{
raid5_conf_t *conf;
- int working_disks = 0, chunk_size;
+ int working_disks = 0;
int dirty_parity_disks = 0;
mdk_rdev_t *rdev;
sector_t reshape_offset = 0;
@@ -5113,6 +5113,7 @@ static int run(mddev_t *mddev)
plugger_init(&conf->plug, raid5_unplug);
mddev->plug = &conf->plug;
if (mddev->queue) {
+ int chunk_size;
/* read-ahead size must cover two whole stripes, which
* is 2 * (datadisks) * chunksize where 'n' is the
* number of raid devices
@@ -5130,16 +5131,16 @@ static int run(mddev_t *mddev)
mddev->queue->queue_lock = &conf->device_lock;
mddev->queue->unplug_fn = raid5_unplug_queue;
- }
- chunk_size = mddev->chunk_sectors << 9;
- blk_queue_io_min(mddev->queue, chunk_size);
- blk_queue_io_opt(mddev->queue, chunk_size *
- (conf->raid_disks - conf->max_degraded));
+ chunk_size = mddev->chunk_sectors << 9;
+ blk_queue_io_min(mddev->queue, chunk_size);
+ blk_queue_io_opt(mddev->queue, chunk_size *
+ (conf->raid_disks - conf->max_degraded));
- list_for_each_entry(rdev, &mddev->disks, same_set)
- disk_stack_limits(mddev->gendisk, rdev->bdev,
- rdev->data_offset << 9);
+ list_for_each_entry(rdev, &mddev->disks, same_set)
+ disk_stack_limits(mddev->gendisk, rdev->bdev,
+ rdev->data_offset << 9);
+ }
return 0;
abort:
next prev 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 02/12] md/raid5: factor out code for changing size of stripe cache NeilBrown
2010-04-15 6:43 ` [PATCH 04/12] dm-raid456: add support for raising events to userspace NeilBrown
2010-04-15 6:43 ` NeilBrown [this message]
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 ` [PATCH 03/12] md/dm: create dm-raid456 module using md/raid5 NeilBrown
2010-04-15 6:43 ` [PATCH 11/12] dm-raid456: add suspend/resume method 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 07/12] md/raid5: add simple plugging infrastructure NeilBrown
2010-04-15 6:43 ` [PATCH 01/12] md: reduce dependence on sysfs NeilBrown
2010-04-15 6:43 ` [PATCH 06/12] dm-raid456: add congestion checking NeilBrown
2010-04-15 6:43 ` [PATCH 12/12] dm-raid456: add message handler 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.3504.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).