All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] expose dm-stripe target's topology I/O hints
@ 2009-07-10 21:33 Mike Snitzer
  2009-08-05 13:07 ` Mike Snitzer
  2009-08-21 14:16 ` Mike Snitzer
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Snitzer @ 2009-07-10 21:33 UTC (permalink / raw)
  To: dm-devel; +Cc: Martin K. Petersen

Add .io_hints to 'struct target_type' to allow the I/O hints portion of
the 'struct queue_limits' to be set by each target.  Expose dm-stripe
target's topology I/O hints.

NOTE: This patch makes use of blk_limits_io_min(); which will be
upstream, via the block tree, in the near future.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---

diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index b240e85..9350566 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -328,6 +328,16 @@ static int stripe_iterate_devices(struct dm_target *ti,
 	return ret;
 }
 
+static void stripe_io_hints(struct dm_target *ti,
+			    struct queue_limits *limits)
+{
+	struct stripe_c *sc = ti->private;
+	unsigned chunk_size = (sc->chunk_mask + 1) << 9;
+
+	blk_limits_io_min(chunk_size);
+	limits->io_opt = chunk_size * sc->stripes;
+}
+
 static struct target_type stripe_target = {
 	.name   = "striped",
 	.version = {1, 2, 0},
@@ -338,6 +348,7 @@ static struct target_type stripe_target = {
 	.end_io = stripe_end_io,
 	.status = stripe_status,
 	.iterate_devices = stripe_iterate_devices,
+	.io_hints = stripe_io_hints,
 };
 
 int __init dm_stripe_init(void)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5d16d06..5dcdcfe 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -996,6 +996,10 @@ int dm_calculate_queue_limits(struct dm_table *table,
 		ti->type->iterate_devices(ti, dm_set_device_limits,
 					  &ti_limits);
 
+		/* Set I/O hints portion of queue limits */
+		if (ti->type->io_hints)
+			ti->type->io_hints(ti, &ti_limits);
+
 		/*
 		 * Check each device area is consistent with the target's
 		 * overall queue limits.
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 0d63106..e2b4865 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -91,6 +91,9 @@ typedef int (*dm_iterate_devices_fn) (struct dm_target *ti,
 				      iterate_devices_callout_fn fn,
 				      void *data);
 
+typedef void (*dm_io_hints_fn) (struct dm_target *ti,
+				struct queue_limits *limits);
+
 /*
  * Returns:
  *    0: The target can handle the next I/O immediately.
@@ -151,6 +154,7 @@ struct target_type {
 	dm_merge_fn merge;
 	dm_busy_fn busy;
 	dm_iterate_devices_fn iterate_devices;
+	dm_io_hints_fn io_hints;
 
 	/* For internal device-mapper use. */
 	struct list_head list;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: expose dm-stripe target's topology I/O hints
  2009-07-10 21:33 [PATCH] expose dm-stripe target's topology I/O hints Mike Snitzer
@ 2009-08-05 13:07 ` Mike Snitzer
  2009-08-21 14:16 ` Mike Snitzer
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2009-08-05 13:07 UTC (permalink / raw)
  To: agk; +Cc: dm-devel, Martin K. Petersen

On Fri, Jul 10 2009 at  5:33pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> Add .io_hints to 'struct target_type' to allow the I/O hints portion of
> the 'struct queue_limits' to be set by each target.  Expose dm-stripe
> target's topology I/O hints.
> 
> NOTE: This patch makes use of blk_limits_io_min(); which will be
> upstream, via the block tree, in the near future.

Linus has pulled in the block changes that this patch depends on; see
linux-2.6 commits:
7c958e32649e0c35801762878fb0b6da8c55a515
70dd5bf3b99964d52862ad2810c24cc32a553535

So this .io_hints patch is good to go upstream now.

Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: expose dm-stripe target's topology I/O hints
  2009-07-10 21:33 [PATCH] expose dm-stripe target's topology I/O hints Mike Snitzer
  2009-08-05 13:07 ` Mike Snitzer
@ 2009-08-21 14:16 ` Mike Snitzer
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2009-08-21 14:16 UTC (permalink / raw)
  To: dm-devel

On Fri, Jul 10 2009 at  5:33pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> Add .io_hints to 'struct target_type' to allow the I/O hints portion of
> the 'struct queue_limits' to be set by each target.  Expose dm-stripe
> target's topology I/O hints.
> 
> NOTE: This patch makes use of blk_limits_io_min(); which will be
> upstream, via the block tree, in the near future.
> 
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
> 
> diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
> index b240e85..9350566 100644
> --- a/drivers/md/dm-stripe.c
> +++ b/drivers/md/dm-stripe.c
> @@ -328,6 +328,16 @@ static int stripe_iterate_devices(struct dm_target *ti,
>  	return ret;
>  }
>  
> +static void stripe_io_hints(struct dm_target *ti,
> +			    struct queue_limits *limits)
> +{
> +	struct stripe_c *sc = ti->private;
> +	unsigned chunk_size = (sc->chunk_mask + 1) << 9;
> +
> +	blk_limits_io_min(chunk_size);
> +	limits->io_opt = chunk_size * sc->stripes;
> +}

The call to blk_limits_io_min() is missing the first queue_limits arg.

I'll send v2 of this patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-08-21 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-10 21:33 [PATCH] expose dm-stripe target's topology I/O hints Mike Snitzer
2009-08-05 13:07 ` Mike Snitzer
2009-08-21 14:16 ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.