linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: jbrassow@redhat.com, neilb@suse.de
Cc: agk@redhat.com, dm-devel@redhat.com, linux-raid@vger.kernel.org
Subject: [PATCH v3 7/8] dm raid: add iterate_devices and io_hints functions
Date: Mon, 20 Dec 2010 21:37:44 -0500	[thread overview]
Message-ID: <1292899065-31943-8-git-send-email-snitzer@redhat.com> (raw)
In-Reply-To: <1292899065-31943-1-git-send-email-snitzer@redhat.com>

From: NeilBrown <neilb@suse.de>

Add .iterate_devices function which should be implemented for all DM
targets.

Add an .io_hints function too because the provided topology information
is particularly important for a raid device.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/md/dm-raid.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 4db3eab..6494833 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -577,6 +577,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].data_dev)
+			ret = fn(ti,
+				 rs->dev[i].data_dev,
+				 0, /* No offset on data devs */
+				 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 = "raid",
 	.version = {1, 0, 0},
@@ -585,6 +616,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)
-- 
1.7.2.3


  parent reply	other threads:[~2010-12-21  2:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21  2:37 [PATCH v3 0/8] dm-raid (raid456) target Mike Snitzer
2010-12-21  2:37 ` [PATCH v3 1/8] md/bitmap: revert dm-dirty-log preparation Mike Snitzer
2010-12-21  2:37 ` [PATCH v3 2/8] md/bitmap: use DIV_ROUND_UP in bitmap_init_from_disk Mike Snitzer
2010-12-21  2:37 ` [PATCH v3 3/8] md/raid5: use sysfs_notify_dirent_safe to avoid NULL pointer Mike Snitzer
2010-12-21  2:37 ` [PATCH v3 4/8] dm raid: skeleton raid456 target support Mike Snitzer
2010-12-21  2:37 ` [PATCH v3 5/8] dm: introduce target callbacks and congestion callback Mike Snitzer
2010-12-21  2:37 ` [PATCH v3 6/8] dm: per-target unplug callback support Mike Snitzer
2010-12-21  2:37 ` Mike Snitzer [this message]
2010-12-21  2:37 ` [PATCH v3 8/8] dm raid: add suspend and resume functions Mike Snitzer
2010-12-21  3:14 ` [PATCH v3 0/8] dm-raid (raid456) target Neil Brown
2011-01-05 22:36   ` Mike Snitzer
2011-01-06 10:46     ` NeilBrown
2011-01-06 14:43       ` Jonathan Brassow
2011-01-10  0:37         ` NeilBrown
2011-01-10 20:14           ` Jonathan Brassow
2011-01-06 15:56       ` [dm-devel] " Phillip Susi
2011-01-06 20:59         ` Jonathan Brassow
2011-01-06 21:01       ` Jonathan Brassow

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=1292899065-31943-8-git-send-email-snitzer@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=jbrassow@redhat.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).