From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAxcL-00019p-DJ for qemu-devel@nongnu.org; Wed, 17 May 2017 07:59:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAxcK-0000bK-Mo for qemu-devel@nongnu.org; Wed, 17 May 2017 07:59:49 -0400 From: Juan Quintela In-Reply-To: <20170516204724.1617-10-eblake@redhat.com> (Eric Blake's message of "Tue, 16 May 2017 15:47:21 -0500") References: <20170516204724.1617-1-eblake@redhat.com> <20170516204724.1617-10-eblake@redhat.com> Reply-To: quintela@redhat.com Date: Wed, 17 May 2017 13:59:23 +0200 Message-ID: <871srnd78k.fsf@secure.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 09/12] dirty-bitmap: Change bdrv_[re]set_dirty_bitmap() to use bytes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, jsnow@redhat.com, qemu-block@nongnu.org, Fam Zheng , Kevin Wolf , Max Reitz , Jeff Cody , Stefan Hajnoczi , "Dr. David Alan Gilbert" Eric Blake wrote: > Some of the callers were already scaling bytes to sectors; others > can be easily converted to pass byte offsets, all in our shift > towards a consistent byte interface everywhere. Making the change > will also make it easier to write the hold-out callers to use byte > rather than sectors for their iterations; it also makes it easier > for a future dirty-bitmap patch to offload scaling over to the > internal hbitmap. Although all callers happen to pass > sector-aligned values, make the internal scaling robust to any > sub-sector requests. > > Signed-off-by: Eric Blake > Reviewed-by: John Snow Reviewed-by: Juan Quintela > + > assert(bdrv_dirty_bitmap_enabled(bitmap)); > - hbitmap_set(bitmap->bitmap, cur_sector, nr_sectors); > + hbitmap_set(bitmap->bitmap, offset >> BDRV_SECTOR_BITS, > + end_sector - (offset >> BDRV_SECTOR_BITS)); It is just me, or we use: bytes = sectors * BDRV_SECTOR_SIZE or bytes = sectors << BDRV_SECTOR_BITS and the same from bytes to sectors (no, this patch is consistent, but just looking at the file ....) Later, Juan.