[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/8] iotests/257: add EmulatedBitmap class
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH 2/8] iotests/257: add EmulatedBitmap class |
Date: |
Wed, 10 Jul 2019 17:47:32 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 10.07.19 03:05, John Snow wrote:
> Represent a bitmap with an object that we can mark and clear bits in.
> This makes it easier to manage partial writes when we don't write a
> full group's worth of patterns before an error.
>
> Signed-off-by: John Snow <address@hidden>
> ---
> tests/qemu-iotests/257 | 125 +++++++++++++++++++++++++----------------
> 1 file changed, 76 insertions(+), 49 deletions(-)
>
> diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257
> index f576a35a5c..2ff4aa8695 100755
> --- a/tests/qemu-iotests/257
> +++ b/tests/qemu-iotests/257
> @@ -85,6 +85,60 @@ GROUPS = [
> Pattern('0xdd', 0x3fc0000)]), # New; leaving a gap to the right
> ]
>
> +
> +class EmulatedBitmap:
> + def __init__(self, granularity=GRANULARITY):
> + self._bits = set()
> + self.groups = set()
> + self.granularity = granularity
> +
> + def dirty_bits(self, bits):
> + self._bits |= set(bits)
> +
> + def dirty_group(self, n):
> + self.dirty_bits(GROUPS[n].bits(self.granularity))
> +
> + def clear(self):
> + self._bits = set()
> +
> + def clear_bits(self, bits):
> + self._bits = self._bits - set(bits)
Does -= not work here?
No real complaints. Sorry.
Reviewed-by: Max Reitz <address@hidden>
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 6/8] block/backup: issue progress updates for skipped regions, John Snow, 2019/07/09