All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, Edward Thornber <thornber@redhat.com>,
	"Alasdair G. Kergon" <agk@redhat.com>
Subject: Re: [PATCH 3/3] dm-thin: fix discard_granularity
Date: Tue, 17 Jul 2012 11:31:41 -0400	[thread overview]
Message-ID: <20120717153140.GA18345@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1207161435230.3859@file.rdu.redhat.com>

On Mon, Jul 16 2012 at  2:35pm -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> dm-thin: fix discard_granularity
> 
> The kernel expects that limits->discard_granularity is a power of two.
> Set this limit only if we use a power of two block size.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  drivers/md/dm-thin.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-3.5-rc6-fast/drivers/md/dm-thin.c
> ===================================================================
> --- linux-3.5-rc6-fast.orig/drivers/md/dm-thin.c	2012-07-16 20:07:49.000000000 +0200
> +++ linux-3.5-rc6-fast/drivers/md/dm-thin.c	2012-07-16 20:08:01.000000000 +0200
> @@ -2502,7 +2502,8 @@ static void set_discard_limits(struct po
>  	 * bios cover a block partially.  A discard that spans a block boundary
>  	 * is not sent to this target.
>  	 */
> -	limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
> +	if (pool->sectors_per_block_shift >= 0)
> +		limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
>  	limits->discard_zeroes_data = pool->pf.zero_new_blocks;
>  }

Given the block layer's assumption that discard_granularity is always a
power of 2: thinp should disable discard if the thinp blocksize is a non
power of 2.  So this patch isn't correct (discard support should be
disabled in pool_ctr based on the specified blocksize).

Future work should be:
1) explore/eliminate the block layer's power of 2 constraints
2) divorce thinp's discard limits (for discard passdown) from the pool's
   blocksize

  reply	other threads:[~2012-07-17 15:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16 18:34 [PATCH 0/3] Fix discards on dm-thin Mikulas Patocka
2012-07-16 18:34 ` [PATCH 1/3] dm: introduce split_discard_requests Mikulas Patocka
2012-07-16 18:35   ` [PATCH 2/3] dm-thin: fix discard support Mikulas Patocka
2012-07-16 18:35     ` [PATCH 3/3] dm-thin: fix discard_granularity Mikulas Patocka
2012-07-17 15:31       ` Mike Snitzer [this message]
2012-07-17 19:35         ` Mikulas Patocka
2012-07-17 21:52           ` Vivek Goyal
2012-07-18 19:10             ` Mikulas Patocka
2012-07-19 15:44               ` Vivek Goyal
2012-07-17 13:26     ` [PATCH 2/3] dm-thin: fix discard support Vivek Goyal
2012-07-17 13:58       ` Mike Snitzer
2012-07-17 14:18         ` Mikulas Patocka
2012-07-17 14:49           ` 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=20120717153140.GA18345@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=thornber@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.