From: Mike Snitzer <snitzer@redhat.com>
To: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: device-mapper development <dm-devel@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
linux-kernel@vger.kernel.org, Alasdair G Kergon <agk@redhat.com>,
jaxboe@fusionio.com
Subject: Re: dm: check max_sectors in dm_merge_bvec (was: Re: dm: max_segments=1 if merge_bvec_fn is not supported)
Date: Sat, 4 Dec 2010 14:21:29 -0500 [thread overview]
Message-ID: <20101204192128.GA13871@redhat.com> (raw)
In-Reply-To: <20101204160334.GD6034@barkeeper1-xen.linbit>
On Sat, Dec 04 2010 at 11:03am -0500,
Lars Ellenberg <lars.ellenberg@linbit.com> wrote:
> On Sat, Dec 04, 2010 at 01:43:08AM -0500, Mike Snitzer wrote:
>
> > Given dm_set_device_limits() sets q->limits->max_sectors,
> > shouldn't dm_merge_bvec() be using queue_max_sectors rather than
> > queue_max_hw_sectors?
> >
> > blk_queue_max_hw_sectors() establishes that max_hw_sectors is the hard
> > limit and max_sectors the soft. But AFAICT no relation is maintained
> > between the two over time (even though max_sectors <= max_hw_sectors
> > _should_ be enforced; in practice there is no blk_queue_max_sectors
> > setter that uniformly enforces as much).
>
> Just for the record, in case someone finds this in the archives,
> and wants to backport or base his own work on this:
>
> A long time ago, there was no .max_hw_sectors. Then max_hw_sectors got
> introduced, but without accessor function.
>
> Before 2.6.31, there was no blk_queue_max_hw_sectors(),
> only blk_queue_max_sectors(), which set both.
>
> 2.6.31 introduced some blk_queue_max_hw_sectors(), which _only_ set
> max_hw_sectors, and enforced a lower limit of BLK_DEF_MAX_SECTORS, so
> using that only, you have not been able to actually set lower limits
> than 512 kB. With 2.6.31 to 2.6.33, inclusive, you still need to use
> blk_queue_max_sectors() to set your limits.
>
> 2.6.34 finally dropped the newly introduced function again,
> but renamed the other, so starting with 2.6.34 you need to use
> blk_queue_max_hw_sectors(), which now basically has the function body
> blk_queue_max_sectors() had up until 2.6.33.
>
> > dm_set_device_limits() will set q->limits->max_sectors to <= PAGE_SIZE
> > if an underlying device has a merge_bvec_fn. Therefore, dm_merge_bvec()
> > must use queue_max_sectors() rather than queue_max_hw_sectors() to check
> > the appropriate limit.
>
> IMO, you should not do this.
> max_sectors is a user tunable, capped by max_hw_sectors.
> max_hw_sectors is the driver limit.
>
> Please set max_hw_sectors in dm_set_device_limits instead.
Right, good point.. will do (unless I happen upon a reason not to or
someone else shouts).
Thanks,
Mike
prev parent reply other threads:[~2010-12-04 19:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 21:10 [PATCH] dm: max_segments=1 if merge_bvec_fn is not supported Lars Ellenberg
2010-03-08 5:33 ` Neil Brown
2010-03-08 8:35 ` Mikulas Patocka
2010-03-08 13:14 ` Lars Ellenberg
2010-03-18 18:48 ` Andrew Morton
2010-03-18 21:48 ` Neil Brown
2010-12-04 6:43 ` [PATCH] dm: check max_sectors in dm_merge_bvec (was: Re: dm: max_segments=1 if merge_bvec_fn is not supported) Mike Snitzer
2010-12-04 16:03 ` Lars Ellenberg
2010-12-04 19:21 ` Mike Snitzer [this message]
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=20101204192128.GA13871@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=jaxboe@fusionio.com \
--cc=lars.ellenberg@linbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
/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).