From patchwork Wed Jan 16 01:01:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 10765291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18E46184E for ; Wed, 16 Jan 2019 01:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081142B839 for ; Wed, 16 Jan 2019 01:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F09092DE79; Wed, 16 Jan 2019 01:05:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8CF162DD8B for ; Wed, 16 Jan 2019 01:05:54 +0000 (UTC) Received: from localhost ([127.0.0.1]:37502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjZeT-0006Kq-Mu for patchwork-qemu-devel@patchwork.kernel.org; Tue, 15 Jan 2019 20:05:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjZaJ-0002n9-1Z for qemu-devel@nongnu.org; Tue, 15 Jan 2019 20:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjZa3-0004Vv-SZ for qemu-devel@nongnu.org; Tue, 15 Jan 2019 20:01:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjZa3-0004Rx-4j for qemu-devel@nongnu.org; Tue, 15 Jan 2019 20:01:19 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 137666445C; Wed, 16 Jan 2019 01:01:14 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-221.bos.redhat.com [10.18.17.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7724B19C7C; Wed, 16 Jan 2019 01:01:13 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2019 20:01:04 -0500 Message-Id: <20190116010106.27626-7-jsnow@redhat.com> In-Reply-To: <20190116010106.27626-1-jsnow@redhat.com> References: <20190116010106.27626-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 16 Jan 2019 01:01:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/8] Revert "block/dirty-bitmap: Add bdrv_dirty_iter_next_area" 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: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Sementsov-Ogievskiy This reverts commit 72d10a94213a954ad569095cb4491f2ae0853c40. The function is unused now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Signed-off-by: John Snow --- block/dirty-bitmap.c | 55 ------------------------------------ include/block/dirty-bitmap.h | 2 -- 2 files changed, 57 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index c1518373f9..4d9a8af17d 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -518,61 +518,6 @@ int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter) return hbitmap_iter_next(&iter->hbi, true); } -/** - * Return the next consecutively dirty area in the dirty bitmap - * belonging to the given iterator @iter. - * - * @max_offset: Maximum value that may be returned for - * *offset + *bytes - * @offset: Will contain the start offset of the next dirty area - * @bytes: Will contain the length of the next dirty area - * - * Returns: True if a dirty area could be found before max_offset - * (which means that *offset and *bytes then contain valid - * values), false otherwise. - * - * Note that @iter is never advanced if false is returned. If an area - * is found (which means that true is returned), it will be advanced - * past that area. - */ -bool bdrv_dirty_iter_next_area(BdrvDirtyBitmapIter *iter, uint64_t max_offset, - uint64_t *offset, int *bytes) -{ - uint32_t granularity = bdrv_dirty_bitmap_granularity(iter->bitmap); - uint64_t gran_max_offset; - int64_t ret; - int size; - - if (max_offset == iter->bitmap->size) { - /* If max_offset points to the image end, round it up by the - * bitmap granularity */ - gran_max_offset = ROUND_UP(max_offset, granularity); - } else { - gran_max_offset = max_offset; - } - - ret = hbitmap_iter_next(&iter->hbi, false); - if (ret < 0 || ret + granularity > gran_max_offset) { - return false; - } - - *offset = ret; - size = 0; - - assert(granularity <= INT_MAX); - - do { - /* Advance iterator */ - ret = hbitmap_iter_next(&iter->hbi, true); - size += granularity; - } while (ret + granularity <= gran_max_offset && - hbitmap_iter_next(&iter->hbi, false) == ret + granularity && - size <= INT_MAX - granularity); - - *bytes = MIN(size, max_offset - *offset); - return true; -} - /* Called within bdrv_dirty_bitmap_lock..unlock */ void bdrv_set_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap, int64_t offset, int64_t bytes) diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 4ef00ca6ba..04a117fc81 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -83,8 +83,6 @@ void bdrv_set_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap, void bdrv_reset_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap, int64_t offset, int64_t bytes); int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter); -bool bdrv_dirty_iter_next_area(BdrvDirtyBitmapIter *iter, uint64_t max_offset, - uint64_t *offset, int *bytes); void bdrv_set_dirty_iter(BdrvDirtyBitmapIter *hbi, int64_t offset); int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap); int64_t bdrv_get_meta_dirty_count(BdrvDirtyBitmap *bitmap);