All of lore.kernel.org
 help / color / mirror / Atom feed
* How can need dm use limits.max_hw_sectors from the bdev?
@ 2016-01-17  6:34 Eric Wheeler
  2016-01-18 15:56 ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wheeler @ 2016-01-17  6:34 UTC (permalink / raw)
  To: dm-devel

Hello all,

I'm writing a trivial dm target and hitting errors like this:
   io too big device loop0 (2048 > 255)

which looks like the problem described here:
	https://bugzilla.kernel.org/show_bug.cgi?id=9401#c3

and is is consistent:
	cat /sys/block/loop0/queue/max_hw_sectors_kb 
	127
	# cat /sys/block/dm-4/queue/max_hw_sectors_kb 
	2147483647

By tracing from sysfs it looks like I need to do something like this when 
called from the target constructor (dm_ctr_fn target_type.ctr) function:

    target->table->md->queue->limits.max_hw_sectors =
        priv->dm_dev_bdev->bdev->bd_queue->limits.max_hw_sectors;

but I cannot because `struct md` and `struct mapped_device` are opaque
which makes me think there is a better (correct) way to do this.  Is there a way
to change my target device's max_hw_sectors value to 127?

Is there some other generic solution?

Would late bio splitting solve this?

-Eric

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

* Re: How can need dm use limits.max_hw_sectors from the bdev?
  2016-01-17  6:34 How can need dm use limits.max_hw_sectors from the bdev? Eric Wheeler
@ 2016-01-18 15:56 ` Mike Snitzer
  2016-01-20  3:00   ` How can " Eric Wheeler
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2016-01-18 15:56 UTC (permalink / raw)
  To: Eric Wheeler; +Cc: dm-devel

On Sun, Jan 17 2016 at  1:34am -0500,
Eric Wheeler <dm-devel@lists.ewheeler.net> wrote:

> Hello all,
> 
> I'm writing a trivial dm target and hitting errors like this:
>    io too big device loop0 (2048 > 255)
> 
> which looks like the problem described here:
> 	https://bugzilla.kernel.org/show_bug.cgi?id=9401#c3
> 
> and is is consistent:
> 	cat /sys/block/loop0/queue/max_hw_sectors_kb 
> 	127
> 	# cat /sys/block/dm-4/queue/max_hw_sectors_kb 
> 	2147483647
> 
> By tracing from sysfs it looks like I need to do something like this when 
> called from the target constructor (dm_ctr_fn target_type.ctr) function:
> 
>     target->table->md->queue->limits.max_hw_sectors =
>         priv->dm_dev_bdev->bdev->bd_queue->limits.max_hw_sectors;
> 
> but I cannot because `struct md` and `struct mapped_device` are opaque
> which makes me think there is a better (correct) way to do this.  Is there a way
> to change my target device's max_hw_sectors value to 127?
> 
> Is there some other generic solution?

You'll first want to implement the .iterate_devices hook.  This alone
should enable DM core to leverage the block layer's blk_stack_limits()
infrastructure to stack up your top-level device's queue_limits.

And if you'd like to override your device's queue_limits beyond what is
stacked up from the underlying device(s) you can implement the .io_hints
hook in your target.

> Would late bio splitting solve this?

Maybe, if by solve this you mean: the block core won't error any more.
But you're better off stacking underlying devices' queue_limits like I
detailed above.

Mike

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

* Re: How can dm use limits.max_hw_sectors from the bdev?
  2016-01-18 15:56 ` Mike Snitzer
@ 2016-01-20  3:00   ` Eric Wheeler
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Wheeler @ 2016-01-20  3:00 UTC (permalink / raw)
  To: device-mapper development

On Mon, 18 Jan 2016, Mike Snitzer wrote:

> On Sun, Jan 17 2016 at  1:34am -0500,
> Eric Wheeler <dm-devel@lists.ewheeler.net> wrote:
> 
> > Hello all,
> > 
> > I'm writing a trivial dm target and hitting errors like this:
> >    io too big device loop0 (2048 > 255)
> > 
> > which looks like the problem described here:
> > 	https://bugzilla.kernel.org/show_bug.cgi?id=9401#c3
> > 
> > and is consistent:
> > 	cat /sys/block/loop0/queue/max_hw_sectors_kb 
> > 	127
> > 	# cat /sys/block/dm-4/queue/max_hw_sectors_kb 
> > 	2147483647
> > 
> > By tracing from sysfs it looks like I need to do something like this when 
> > called from the target constructor (dm_ctr_fn target_type.ctr) function:
> > 
> >     target->table->md->queue->limits.max_hw_sectors =
> >         priv->dm_dev_bdev->bdev->bd_queue->limits.max_hw_sectors;
> > 
> > but I cannot because `struct md` and `struct mapped_device` are opaque
> > which makes me think there is a better (correct) way to do this.  Is there a way
> > to change my target device's max_hw_sectors value to 127?
> > 
> > Is there some other generic solution?
> 
> You'll first want to implement the .iterate_devices hook.  This alone
> should enable DM core to leverage the block layer's blk_stack_limits()
> infrastructure to stack up your top-level device's queue_limits.
>
> And if you'd like to override your device's queue_limits beyond what is
> stacked up from the underlying device(s) you can implement the .io_hints
> hook in your target.

That did it.  Thank you! 

-Eric

> > Would late bio splitting solve this?
> 
> Maybe, if by solve this you mean: the block core won't error any more.
> But you're better off stacking underlying devices' queue_limits like I
> detailed above.
> 
> Mike
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
> 

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

end of thread, other threads:[~2016-01-20  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-17  6:34 How can need dm use limits.max_hw_sectors from the bdev? Eric Wheeler
2016-01-18 15:56 ` Mike Snitzer
2016-01-20  3:00   ` How can " Eric Wheeler

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.