From patchwork Wed Jun 13 02:06:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 10461523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C6B42601C0 for ; Wed, 13 Jun 2018 02:28:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED301FF81 for ; Wed, 13 Jun 2018 02:28:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F02926530; Wed, 13 Jun 2018 02:28:20 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0041C1FF81 for ; Wed, 13 Jun 2018 02:28:19 +0000 (UTC) Received: from localhost ([::1]:59453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSvWE-0000kZ-QN for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Jun 2018 22:28:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSvAz-0001OU-OW for qemu-devel@nongnu.org; Tue, 12 Jun 2018 22:06:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSvAx-0001ej-UN for qemu-devel@nongnu.org; Tue, 12 Jun 2018 22:06:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53548 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSvAs-0001ZO-OD; Tue, 12 Jun 2018 22:06:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D5B5859AE; Wed, 13 Jun 2018 02:06:14 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-177.bos.redhat.com [10.18.17.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07B8D2028674; Wed, 13 Jun 2018 02:06:14 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 12 Jun 2018 22:06:04 -0400 Message-Id: <20180613020613.1343-2-jsnow@redhat.com> In-Reply-To: <20180613020613.1343-1-jsnow@redhat.com> References: <20180613020613.1343-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 13 Jun 2018 02:06:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 13 Jun 2018 02:06:14 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 01/10] qcow2/bitmap: remove redundant arguments from bitmap_list_load 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 , Vladimir Sementsov-Ogievskiy , Markus Armbruster , Max Reitz , John Snow Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We always call it with the same fields of the struct we always pass. We can split this out later if we really wind up needing to. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/qcow2-bitmap.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 69485aa1de..0670e5eb41 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -535,8 +535,7 @@ static uint32_t bitmap_list_count(Qcow2BitmapList *bm_list) * Get bitmap list from qcow2 image. Actually reads bitmap directory, * checks it and convert to bitmap list. */ -static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset, - uint64_t size, Error **errp) +static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, Error **errp) { int ret; BDRVQcow2State *s = bs->opaque; @@ -544,6 +543,8 @@ static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset, Qcow2BitmapDirEntry *e; uint32_t nb_dir_entries = 0; Qcow2BitmapList *bm_list = NULL; + uint64_t offset = s->bitmap_directory_offset; + uint64_t size = s->bitmap_directory_size; if (size == 0) { error_setg(errp, "Requested bitmap directory size is zero"); @@ -655,8 +656,7 @@ int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res, return ret; } - bm_list = bitmap_list_load(bs, s->bitmap_directory_offset, - s->bitmap_directory_size, NULL); + bm_list = bitmap_list_load(bs, NULL); if (bm_list == NULL) { res->corruptions++; return -EINVAL; @@ -952,8 +952,7 @@ bool qcow2_load_dirty_bitmaps(BlockDriverState *bs, Error **errp) return false; } - bm_list = bitmap_list_load(bs, s->bitmap_directory_offset, - s->bitmap_directory_size, errp); + bm_list = bitmap_list_load(bs, errp); if (bm_list == NULL) { return false; } @@ -1026,8 +1025,7 @@ int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated, return -EINVAL; } - bm_list = bitmap_list_load(bs, s->bitmap_directory_offset, - s->bitmap_directory_size, errp); + bm_list = bitmap_list_load(bs, errp); if (bm_list == NULL) { return -EINVAL; } @@ -1276,8 +1274,7 @@ void qcow2_remove_persistent_dirty_bitmap(BlockDriverState *bs, return; } - bm_list = bitmap_list_load(bs, s->bitmap_directory_offset, - s->bitmap_directory_size, errp); + bm_list = bitmap_list_load(bs, errp); if (bm_list == NULL) { return; } @@ -1329,8 +1326,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp) if (s->nb_bitmaps == 0) { bm_list = bitmap_list_new(); } else { - bm_list = bitmap_list_load(bs, s->bitmap_directory_offset, - s->bitmap_directory_size, errp); + bm_list = bitmap_list_load(bs, errp); if (bm_list == NULL) { return; } @@ -1494,8 +1490,7 @@ bool qcow2_can_store_new_dirty_bitmap(BlockDriverState *bs, goto fail; } - bm_list = bitmap_list_load(bs, s->bitmap_directory_offset, - s->bitmap_directory_size, errp); + bm_list = bitmap_list_load(bs, errp); if (bm_list == NULL) { goto fail; }