From nobody Mon Feb 9 21:36:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494968074060237.63024519445207; Tue, 16 May 2017 13:54:34 -0700 (PDT) Received: from localhost ([::1]:43980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAjUG-0007dD-R2 for importer@patchew.org; Tue, 16 May 2017 16:54:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAjNm-0002gO-IU for qemu-devel@nongnu.org; Tue, 16 May 2017 16:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAjNl-0003bS-OA for qemu-devel@nongnu.org; Tue, 16 May 2017 16:47:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAjNi-0003Wu-Nm; Tue, 16 May 2017 16:47:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 718B73D955; Tue, 16 May 2017 20:47:45 +0000 (UTC) Received: from red.redhat.com (ovpn-123-244.rdu2.redhat.com [10.10.123.244]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5A645C466; Tue, 16 May 2017 20:47:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 718B73D955 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 718B73D955 From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 16 May 2017 15:47:18 -0500 Message-Id: <20170516204724.1617-7-eblake@redhat.com> In-Reply-To: <20170516204724.1617-1-eblake@redhat.com> References: <20170516204724.1617-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 16 May 2017 20:47:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 06/12] dirty-bitmap: Change bdrv_dirty_iter_next() to report byte offset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Jeff Cody , Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Thanks to recent cleanups, all callers were scaling a return value of sectors into bytes; do the scaling internally instead. Signed-off-by: Eric Blake Reviewed-by: John Snow --- v2: no change --- block/backup.c | 2 +- block/dirty-bitmap.c | 2 +- block/mirror.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/backup.c b/block/backup.c index 70126b8..dc3c7f2 100644 --- a/block/backup.c +++ b/block/backup.c @@ -375,7 +375,7 @@ static int coroutine_fn backup_run_incremental(BackupBl= ockJob *job) dbi =3D bdrv_dirty_iter_new(job->sync_bitmap); /* Find the next dirty sector(s) */ - while ((offset =3D bdrv_dirty_iter_next(dbi) * BDRV_SECTOR_SIZE) >=3D = 0) { + while ((offset =3D bdrv_dirty_iter_next(dbi)) >=3D 0) { cluster =3D offset / job->cluster_size; /* Fake progress updates for any clusters we skipped */ diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 3fb4871..2f9f554 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -397,7 +397,7 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter) int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter) { - return hbitmap_iter_next(&iter->hbi); + return hbitmap_iter_next(&iter->hbi) * BDRV_SECTOR_SIZE; } void bdrv_set_dirty_bitmap(BdrvDirtyBitmap *bitmap, diff --git a/block/mirror.c b/block/mirror.c index 885cc29..8428733 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -335,10 +335,10 @@ static uint64_t coroutine_fn mirror_iteration(MirrorB= lockJob *s) bool write_zeroes_ok =3D bdrv_can_write_zeroes_with_unmap(blk_bs(s->ta= rget)); int max_io_bytes =3D MAX(s->buf_size / MAX_IN_FLIGHT, MAX_IO_BYTES); - offset =3D bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE; + offset =3D bdrv_dirty_iter_next(s->dbi); if (offset < 0) { bdrv_set_dirty_iter(s->dbi, 0); - offset =3D bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE; + offset =3D bdrv_dirty_iter_next(s->dbi); trace_mirror_restart_iter(s, bdrv_get_dirty_count(s->dirty_bitmap)= * BDRV_SECTOR_SIZE); assert(offset >=3D 0); @@ -367,11 +367,11 @@ static uint64_t coroutine_fn mirror_iteration(MirrorB= lockJob *s) break; } - next_dirty =3D bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE; + next_dirty =3D bdrv_dirty_iter_next(s->dbi); if (next_dirty > next_offset || next_dirty < 0) { /* The bitmap iterator's cache is stale, refresh it */ bdrv_set_dirty_iter(s->dbi, next_offset); - next_dirty =3D bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE; + next_dirty =3D bdrv_dirty_iter_next(s->dbi); } assert(next_dirty =3D=3D next_offset); nb_chunks++; --=20 2.9.4