All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Nikos Tsironis <ntsironis@arrikto.com>
Cc: dm-devel@redhat.com, ejt@redhat.com, agk@redhat.com
Subject: Re: dm cache metadata: Fix loading discard bitset
Date: Wed, 17 Apr 2019 10:35:43 -0400	[thread overview]
Message-ID: <20190417143542.GA28069@redhat.com> (raw)
In-Reply-To: <20190417141918.10648-1-ntsironis@arrikto.com>

On Wed, Apr 17 2019 at 10:19am -0400,
Nikos Tsironis <ntsironis@arrikto.com> wrote:

> Add missing dm_bitset_cursor_next() to properly advance the bitset
> cursor.
> 
> Otherwise, the discarded state of all blocks is set according to the
> discarded state of the first block.
> 
> Fixes: ae4a46a1f6 ("dm cache metadata: use bitset cursor api to load discard bitset")
> Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>

Nice catch, I'll obviously mark this for stable@ too.

One comment below.

> ---
>  drivers/md/dm-cache-metadata.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
> index 6fc93834da44..151aa95775be 100644
> --- a/drivers/md/dm-cache-metadata.c
> +++ b/drivers/md/dm-cache-metadata.c
> @@ -1167,11 +1167,18 @@ static int __load_discards(struct dm_cache_metadata *cmd,
>  		if (r)
>  			return r;
>  
> -		for (b = 0; b < from_dblock(cmd->discard_nr_blocks); b++) {
> +		for (b = 0; ; b++) {
>  			r = fn(context, cmd->discard_block_size, to_dblock(b),
>  			       dm_bitset_cursor_get_value(&c));
>  			if (r)
>  				break;
> +
> +			if (b >= (from_dblock(cmd->discard_nr_blocks) - 1))
> +				break;

Not understanding why you moved the conditional inside the loop, I'd
rather keep it in the for().  Or did you have some reason for this?

> +
> +			r = dm_bitset_cursor_next(&c);
> +			if (r)
> +				break;
>  		}
>  
>  		dm_bitset_cursor_end(&c);
> -- 
> 2.11.0
> 

  reply	other threads:[~2019-04-17 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 14:19 [PATCH] dm cache metadata: Fix loading discard bitset Nikos Tsironis
2019-04-17 14:35 ` Mike Snitzer [this message]
2019-04-17 14:54   ` Nikos Tsironis

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=20190417143542.GA28069@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=ntsironis@arrikto.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.