From: Mike Snitzer <snitzer@redhat.com>
To: Milan Broz <mbroz@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: Re: dm table: simplify discard support processing
Date: Thu, 14 Jul 2011 12:11:23 -0400 [thread overview]
Message-ID: <20110714161122.GC12049@redhat.com> (raw)
In-Reply-To: <4E1F0EB3.9010004@redhat.com>
On Thu, Jul 14 2011 at 11:43am -0400,
Milan Broz <mbroz@redhat.com> wrote:
> On 07/14/2011 04:30 PM, Mike Snitzer wrote:
> > Remove 'discards_supported' from the dm_table structure. The same
> > information can be easily discovered from the table's target(s) in
> > dm_table_supports_discards().
> >
> > Also DMWARN if a target sets 'discards_supported' override but forgets
> > to set 'num_discard_requests'.
>
> Why not BUG_ON? It is bug in code on static attribute, isn't? :-)
Because we don't _need_ to BUG the system over programmer error for
how that target implements discards (given discard support is basically
optional, sometimes nice to have, increasingly nice to have in future).
> > @@ -1426,6 +1422,9 @@ bool dm_table_supports_discards(struct dm_table *t)
> > while (i < dm_table_get_num_targets(t)) {
> > ti = dm_table_get_target(t, i++);
> >
> > + if (!ti->num_discard_requests)
> > + return 0;
> > +
>
> > if (ti->discards_supported)
> > return 1;
>
> What if next target has ti->num_discard_requests = 0 here?
> Shouldn't it loop through the all targets always?
Yes it should, but I'm not sure if we are on the same page as to why.
Background:
If a table has a target with discards_supported=1 then the final DM
device's queue must export the ability to handle discards. But only
targets with num_discard_requests>0 will actually have discards past to
them.
ti->discards_supported is used for targets like thinp. Even if the the
thinp pool's underlying data device doesn't support discards the 'thin'
and 'thin-pool' targets do.
So back to the original question: yes, we need to look at all targets to
make sure that one of them doesn't have discards_supported set.
I'll fix this up and send v2.
Thanks,
Mike
next prev parent reply other threads:[~2011-07-14 16:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-14 14:30 [PATCH] dm table: simplify discard support processing Mike Snitzer
2011-07-14 15:43 ` Milan Broz
2011-07-14 16:11 ` Mike Snitzer [this message]
2011-07-14 17:56 ` [PATCH v2] " Mike Snitzer
2011-07-18 15:10 ` Mike Snitzer
2011-07-21 2:53 ` [PATCH v3] dm table: fix and " Mike Snitzer
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=20110714161122.GC12049@redhat.com \
--to=snitzer@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mbroz@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.