[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 2/5] block/mirror: Refresh stale bitmap iterator cach
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 2/5] block/mirror: Refresh stale bitmap iterator cache |
Date: |
Wed, 20 Apr 2016 17:03:29 +0200 |
From: Max Reitz <address@hidden>
If the drive's dirty bitmap is dirtied while the mirror operation is
running, the cache of the iterator used by the mirror code may become
stale and not contain all dirty bits.
This only becomes an issue if we are looking for contiguously dirty
chunks on the drive. In that case, we can easily detect the discrepancy
and just refresh the iterator if one occurs.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/mirror.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/mirror.c b/block/mirror.c
index 2714a77..9df1fae 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -334,6 +334,11 @@ static uint64_t coroutine_fn
mirror_iteration(MirrorBlockJob *s)
}
hbitmap_next = hbitmap_iter_next(&s->hbi);
+ if (hbitmap_next > next_sector || hbitmap_next < 0) {
+ /* The bitmap iterator's cache is stale, refresh it */
+ bdrv_set_dirty_iter(&s->hbi, next_sector);
+ hbitmap_next = hbitmap_iter_next(&s->hbi);
+ }
assert(hbitmap_next == next_sector);
nb_chunks++;
}
--
1.8.3.1
- [Qemu-block] [PULL 0/5] Mirror block job fixes for 2.6.0-rc3, Kevin Wolf, 2016/04/20
- [Qemu-block] [PULL 5/5] iotests: Test case for drive-mirror with unaligned image size, Kevin Wolf, 2016/04/20
- [Qemu-block] [PULL 1/5] block/mirror: Revive dead yielding code, Kevin Wolf, 2016/04/20
- [Qemu-block] [PULL 3/5] mirror: Don't extend the last sub-chunk, Kevin Wolf, 2016/04/20
- [Qemu-block] [PULL 2/5] block/mirror: Refresh stale bitmap iterator cache,
Kevin Wolf <=
- [Qemu-block] [PULL 4/5] iotests: Add iotests.image_size, Kevin Wolf, 2016/04/20
- Re: [Qemu-block] [PULL 0/5] Mirror block job fixes for 2.6.0-rc3, Peter Maydell, 2016/04/20