summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNikos Tsironis <ntsironis@arrikto.com>2019-04-17 17:19:18 +0300
committerMike Snitzer <snitzer@redhat.com>2019-04-18 16:18:25 -0400
commite28adc3bf34e434b30e8d063df4823ba0f3e0529 (patch)
tree17143feaa65a09238fef20063b64d088afeb0a1f /drivers/md
parent7aedf75ff740a98f3683439449cd91c8662d03b2 (diff)
downloadlinux-e28adc3bf34e434b30e8d063df4823ba0f3e0529.tar.gz
linux-e28adc3bf34e434b30e8d063df4823ba0f3e0529.tar.bz2
linux-e28adc3bf34e434b30e8d063df4823ba0f3e0529.zip
dm cache metadata: Fix loading discard bitset
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") Cc: stable@vger.kernel.org Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-cache-metadata.c9
1 files changed, 8 insertions, 1 deletions
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;
+
+ r = dm_bitset_cursor_next(&c);
+ if (r)
+ break;
}
dm_bitset_cursor_end(&c);