From: John Snow <jsnow@redhat.com>
To: Max Reitz <mreitz@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/8] iotests/257: add EmulatedBitmap class
Date: Wed, 10 Jul 2019 13:36:08 -0400 [thread overview]
Message-ID: <40975a77-80e7-9231-8fd2-0ba3d8b08494@redhat.com> (raw)
In-Reply-To: <a246f50d-cce2-27da-c501-f6c01837c4f9@redhat.com>
On 7/10/19 11:47 AM, Max Reitz wrote:
> 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 <jsnow@redhat.com>
>> ---
>> 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 <mreitz@redhat.com>
>
It's okay. I forget which shorthand operators Python has for which types
sometimes.
>>> a = {'a', 'b', 'c'}
>>> a -= {'c'}
>>> a
{'b', 'a'}
Well, apparently it does. I'll change it.
--js
next prev parent reply other threads:[~2019-07-10 17:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 1:05 [Qemu-devel] [PATCH 0/8] bitmaps: allow bitmaps to be used with full and top John Snow
2019-07-10 1:05 ` [Qemu-devel] [PATCH 1/8] iotests/257: add Pattern class John Snow
2019-07-10 15:10 ` Max Reitz
2019-07-10 16:26 ` Max Reitz
2019-07-10 17:34 ` John Snow
2019-07-10 1:05 ` [Qemu-devel] [PATCH 2/8] iotests/257: add EmulatedBitmap class John Snow
2019-07-10 15:47 ` Max Reitz
2019-07-10 17:36 ` John Snow [this message]
2019-07-10 1:05 ` [Qemu-devel] [PATCH 3/8] iotests/257: Refactor backup helpers John Snow
2019-07-10 16:04 ` Max Reitz
2019-07-10 17:52 ` John Snow
2019-07-10 20:17 ` Max Reitz
2019-07-10 1:05 ` [Qemu-devel] [PATCH 4/8] block/backup: hoist bitmap check into QMP interface John Snow
2019-07-10 16:11 ` Max Reitz
2019-07-10 17:57 ` John Snow
2019-07-10 20:19 ` Max Reitz
2019-07-10 1:05 ` [Qemu-devel] [PATCH 5/8] iotests/257: test API failures John Snow
2019-07-10 16:22 ` Max Reitz
2019-07-10 18:00 ` John Snow
2019-07-10 1:05 ` [Qemu-devel] [PATCH 6/8] block/backup: issue progress updates for skipped regions John Snow
2019-07-10 16:36 ` Max Reitz
2019-07-10 18:20 ` John Snow
2019-07-10 20:30 ` Max Reitz
2019-07-10 20:47 ` John Snow
2019-07-10 20:53 ` Max Reitz
2019-07-10 1:05 ` [Qemu-devel] [PATCH 7/8] block/backup: support bitmap sync modes for non-bitmap backups John Snow
2019-07-10 16:48 ` Max Reitz
2019-07-10 18:32 ` John Snow
2019-07-10 20:39 ` Max Reitz
2019-07-10 1:05 ` [Qemu-devel] [PATCH 8/8] iotests/257: test traditional sync modes John Snow
2019-07-10 17:14 ` Max Reitz
2019-07-10 19:00 ` John Snow
2019-07-10 20:46 ` Max Reitz
[not found] ` <2f221513-f173-8d9f-a3b2-d790ef6f6f51@redhat.com>
2019-07-11 12:37 ` Max Reitz
2019-07-11 17:58 ` John Snow
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=40975a77-80e7-9231-8fd2-0ba3d8b08494@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).