From: Mike Snitzer <snitzer@redhat.com>
To: device-mapper development <dm-devel@redhat.com>,
Alasdair G Kergon <agk@redhat.com>, Joe Thornber <ejt@redhat.com>
Subject: Re: dm thin: fix pool target flags that control discard
Date: Mon, 26 Mar 2012 11:33:41 -0400 [thread overview]
Message-ID: <20120326153341.GA4022@redhat.com> (raw)
In-Reply-To: <20120326141520.GA24249@ubuntu>
On Mon, Mar 26 2012 at 10:15am -0400,
Joe Thornber <thornber@redhat.com> wrote:
> On Fri, Mar 23, 2012 at 05:55:02PM -0400, Mike Snitzer wrote:
> > On Fri, Mar 23 2012 at 8:37am -0400,
> > Alasdair G Kergon <agk@redhat.com> wrote:
> >
> > > On Fri, Mar 16, 2012 at 03:22:34PM +0000, Joe Thornber wrote:
> > > > + 'ignore_discard': disable discard support
> > > > + 'no_discard_passdown': don't pass discards down to the underlying data device
> > >
> > > If someone reloads the pool target changing either of these options, how do connected
> > > thin targets pick up the change? If they don't pick it up automatically, how do you
> > > determine whether they did or didn't pick it up - is that internal state not
> > > exposed to userspace yet?
> >
> > Here are various fixes for dm_thin-add-pool-target-flags-to-control-discard.patch
> >
> > o wire up 'discard_passdown' so that it does control whether or not the
> > discard is passed to the pool's underlying data device
>
> This already works, see test_{enable,disable}_passdown() tests here:
>
> https://github.com/jthornber/thinp-test-suite/blob/master/discard_tests.rb
>
> You've got to remember that there are 2 different interacting targets:
>
> i) discard enabled in the 'thin' target will cause mappings to be removed from the btree.
>
> ii) discard enabled in the 'pool' device will cause discards to be passed down.
>
> The following logic is in the pool_ctr:
>
> if (pf.discard_enabled && pf.discard_passdown) {
> ti->discards_supported = 1;
> ti->num_discard_requests = 1;
> }
We reasoned through this already, your code did work. But for the
benefit of others this is why it worked:
thin will process_discard() via bio being deferring in thin_bio_map() --
provided pf.discard_enabled. Then thin will pass the discard on to the
pool device regardless of pf.discard_passdown. dm-core will then drop
the discard because ti->num_discard_requests is 0; but that results in
-EOPNOTSUPP.
Thing is, we don't want to return -EOPNOTSUPP if passdown was disabled.
So I think my change is an improvement (because process_prepared_discard
will now properly bio_endio(m->bio, 0) the discard).
> > o disallow disabling discards if a pool was already configured with
> > discards enabled (the default)
> > - justification is inlined in the code
> > - required pool_ctr knowing whether pool was created or not; so added
> > 'created' flag to __pool_find()
>
> ack, this needs fixing.
We've discussed that it is easier to just disallow changing discard
configuration. And that there was a bug in my early return. So you'll
be sending a follow-up fixup patch.
> > o if 'discard_passdown' is enabled (the default) verify that the pool's
> > data device supports discards; if not warn and disable discard_passdown
>
> Why? Do other targets do this? (no)
The thin target is the first target to use ti->discards_supported.
Setting that will cause dm_table_supports_discards to skip checking if
the target's underlying device(s) natively support discards.
So passdown needs to only be allowed if the underlying data device
supports discard -- otherwise we'll get a bunch of failed discards from
the SCSI layer, etc.
> > o the pool device's discard support should _not_ be limited by whether
> > 'discard_passdown' is enabled or not.
>
> Yes it should.
Yeah, like I said above your approach works (except for the
-EOPNOTSUPP). I just happen to prefer dm-thin taking a more active role
by short-circuting the discard_passdown directly.
next prev parent reply other threads:[~2012-03-26 15:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 15:21 dm-thin patches for 3.4 Joe Thornber
2012-03-16 15:22 ` [PATCH 01/14] dm-thin: don't use the bi_next field for the holder of a cell Joe Thornber
2012-03-16 15:22 ` [PATCH 02/14] dm-thin: remove some documentation for the unimplemented 'trim' target message Joe Thornber
2012-03-16 15:22 ` [PATCH 03/14] dm_thin: dm_sm_root_size() was being called for the wrong space-map Joe Thornber
2012-03-16 15:22 ` [PATCH 04/14] dm_thin: tweak a comment Joe Thornber
2012-03-16 15:22 ` [PATCH 05/14] dm_btree: remove redundant arg from value_ptr() Joe Thornber
2012-03-16 15:22 ` [PATCH 06/14] dm_btree: fix rebalancing of 3 nodes after remove Joe Thornber
2012-03-16 15:22 ` [PATCH 07/14] dm_space_map: remove entries from the ref_count tree if they're no longer needed Joe Thornber
2012-03-16 15:22 ` [PATCH 08/14] dm_thin: add support for read-only external snapshot origins Joe Thornber
2012-03-16 15:22 ` [PATCH 09/14] dm_thin: foundation for discard support Joe Thornber
2012-03-16 15:22 ` [PATCH 10/14] dm_thin: add support for REQ_DISCARD Joe Thornber
2012-03-23 12:45 ` Alasdair G Kergon
2012-03-16 15:22 ` [PATCH 11/14] dm_thin: add pool target flags to control discard Joe Thornber
2012-03-23 12:37 ` Alasdair G Kergon
2012-03-23 21:55 ` [PATCH] dm thin: fix pool target flags that " Mike Snitzer
2012-03-26 14:15 ` Joe Thornber
2012-03-26 15:33 ` Mike Snitzer [this message]
2012-03-26 19:56 ` Mike Snitzer
2012-03-26 15:34 ` [PATCH] " Joe Thornber
2012-03-26 15:46 ` Joe Thornber
2012-03-16 15:22 ` [PATCH 12/14] dm_thin: commit metadata every second Joe Thornber
2012-03-16 15:22 ` [PATCH 13/14] dm_thin: commit just before processing a pool target info request Joe Thornber
2012-03-19 14:00 ` Alasdair G Kergon
2012-03-20 10:12 ` Joe Thornber
2012-03-16 15:22 ` [PATCH 14/14] dm_thin: bump the target versions Joe Thornber
2012-03-20 18:24 ` [PATCH 01/14] dm-thin: don't use the bi_next field for the holder of a cell Alasdair G Kergon
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=20120326153341.GA4022@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ejt@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 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.