Linux Device Mapper development
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Subject: Re: dm: allow a target to relax discard restrictions
Date: Thu, 28 Apr 2011 11:04:49 -0400	[thread overview]
Message-ID: <20110428150448.GA19853@redhat.com> (raw)
In-Reply-To: <20110428084117.GA32658@infradead.org>

On Thu, Apr 28 2011 at  4:41am -0400,
Christoph Hellwig <hch@infradead.org> wrote:

> On Wed, Apr 27, 2011 at 05:55:38PM -0400, Mike Snitzer wrote:
> > A target, like the upcoming thin provisioning target, may want to allow
> > discards even if the underlying devices do not support them natively.
> > 
> > Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> 
> This would work, but I thing it's really confusing to have your
> new discards_supported flag in the dm_target structure in addition
> to the existing discards_supported in the dm_table and the
> num_discard_requests field there.

It's only confusing if you allow it to be ;)  More seriously: I agree,
the target override might lend itself to confusion.

> May we should allow the target to set a tristate
> 
> enum discard_enabled {
> 	NEVER,
> 	ALWAYS,
> 	PASSTHROUGH
> }
> 
> to indicate it's discard support?

[feel free to skip to my question at the very end if I'm boring]

The above would require all targets with num_discard_requests!=0 to have
an additional explicit PASSTHROUGH opt-in.  Seems like a bit much.
Could fix that if we reordered PASSTHROUGH to be the default (0).

But I don't think having an explicit NEVER buys us much; avoids checking
the target for num_discard_requests>0 but that's not a huge win or
anything.  And it would require each target to set NEVER to get that
mini-optimization.

So that leaves:
enum discard_enabled {
       PASSTHROUGH,
       ALWAYS
}

Which is best expressed with a single flag.

With existing code (and proposed target 'discards_supported' override)
NEVER       = ti->num_discard_requests=0
ALWAYS      = ti->discards_supported=1
PASSTHROUGH = ti->num_discard_requests > 0

Would just renaming the target's 'discards_supported' override to
'discards_always_supported' help?  If not that name some other name?

Mike

      reply	other threads:[~2011-04-28 15:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 15:06 [PATCH, RFC] dm: relax discard restrictions Christoph Hellwig
2011-04-27 15:19 ` Mike Snitzer
2011-04-27 21:55   ` [PATCH] dm: allow a target to " Mike Snitzer
2011-04-28  8:41     ` Christoph Hellwig
2011-04-28 15:04       ` 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=20110428150448.GA19853@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    /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