From patchwork Thu May 7 08:47:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 283272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97601C38A2A for ; Thu, 7 May 2020 08:50:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5F3FD2073A for ; Thu, 7 May 2020 08:50:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Xjaml2c7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F3FD2073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWcEN-0003gb-97 for qemu-devel@archiver.kernel.org; Thu, 07 May 2020 04:50:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDA-0001vf-2f; Thu, 07 May 2020 04:48:57 -0400 Received: from mail-eopbgr80138.outbound.protection.outlook.com ([40.107.8.138]:13902 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcCz-0006Er-5e; Thu, 07 May 2020 04:48:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O0r+wwyT4DLPB99vAIOqs0goaIXrXr0lvyB8z34WFySiXa+5rBxaWCrYakvMdRe+HMIEZpRlbbygRDwitFUUOD5XRK3fvivrjIA9SnbsknazYBZRgbQQOe3UbJmhyq1RirrhzwZqF5xcQ24nLU97aA8DCjEWJUIV5wsSCbF6KiS2PB92Kz+9tGEhC73D62X4FPhg+8MsR4jaVNLSvM9eCDwHSjEzcwTJQIT2Zn1x2/uNbC2O0FNRXk/YkLJOUtgC/OJJG+aDS+ib/7Gdc+vQ5cGIVekKt7RVySInZXunfLjSxGpHCEEytH36cWqMXf6PbMd/hkI/pLqrnzyexR4Cww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A4pWlrhdL9T8Rq4NVPiPL4D8ieKlvCJLtG+/pIFicvE=; b=AAd8O4VgwVJFxstNHCeutX07iu2w8K1/bxvVYVxHVHD19YN76AEjeD+CX7HOpG46upj3IiAy/w21qMGQp9XZkPPEEMIZNIxq0am8Sazzo91Q8hfvkkmVXY6MOTM38HQlbX/DNGgiXPLIAr/fPvWY82mcOto/gEgkWu5oOroLY8J5NwtT+BFFrQNwXFC5F5U9SjRaBDFlDtEb20aWYXYiUYJA07StkIx29aquWJ+CsXwur3JcBCbVyIaSI2pUSQdQZi5R6dPF6x+DBciN7YDOzFzR/qRdppwNIzyx4MlMI3OgDkVHTD/P5wrhYOg2zZG0EizcZgknf45CcIHr74Bo8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A4pWlrhdL9T8Rq4NVPiPL4D8ieKlvCJLtG+/pIFicvE=; b=Xjaml2c7iEjcll+rLARMcLOHnKUcYl/pKvfz+rp64PHfXeO0vpVt4lWlfRfvy9rPV94WNVhD8HyRLWAGsiMaZfPodGClCTKf7JQlbZt/oIzDHZyrF7W9q7s8IyWSuFqOt5+XCN1o1TOM8QjOH5Y83EQxutowsLNBW8/I4kPCuoA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Thu, 7 May 2020 08:48:35 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.034; Thu, 7 May 2020 08:48:35 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v2 1/9] qemu-img: convert: don't use unallocated_blocks_are_zero Date: Thu, 7 May 2020 11:47:52 +0300 Message-Id: <20200507084800.20596-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200507084800.20596-1-vsementsov@virtuozzo.com> References: <20200507084800.20596-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.171) by FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26 via Frontend Transport; Thu, 7 May 2020 08:48:34 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7acfce8-318a-4ccc-1c67-08d7f2636ded X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:262; X-Forefront-PRVS: 03965EFC76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2I94GhPKAElWc32aPhUWS2UVmrPlMfJWsTeBMf+3JHNt9A1sGlhF0xUvL9UqxSwksPjOOmBXpYtzrJ3VUfDlWsk5vezjA1HNdEfSFhVI2CO4fiQM/tQt3EBHBqLnmqSdcvWeVEeIXUNa6QkHIqN5bGky6n4uOaBMz+evUE49CaoEUwawVCrlm4mc0VxUzxEar6wGR6oZwNBGX/gBQaChdtm2sJxgovmYFGvo5d0jLgRZ6btTwZR5325UGbmCsg48lXr9gH4BU4nJiFf+7K+OX00/2sCWYAyAB5IA9HCqnv3BAUVW6lyw5y49YYhOGof3j/O6VhbI4b8tkCPQ/+3noU36J66a7aSuzs0b0fpqgIB1a8rq1rY7K03om4wqYio/zth6aCwXHnikDT2FOVO87Td8ZofutRR433ASrZQyWMVx5y4ubQkgzGHUBFfJglcLOvQv6BSi31nSstM1yKh5GNZ4GFCzx+ZCn4bsZk35WoPw1z1pi4WGGrv7JsGVm3ga6n8waQcz1USUxFdQHoxsxyOhyQEfMcEtgU9DBMZe+slKYHUC4JHv4wbb4NqVZMXh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(39850400004)(396003)(366004)(136003)(33430700001)(4326008)(478600001)(66476007)(66946007)(66556008)(5660300002)(69590400007)(2906002)(52116002)(7416002)(6486002)(1076003)(36756003)(86362001)(6512007)(83280400001)(6916009)(186003)(16526019)(83320400001)(956004)(26005)(33440700001)(8676002)(83300400001)(83290400001)(6666004)(2616005)(83310400001)(8936002)(6506007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: dThsPGRrlaslBYljFbH2PeOHMUydWdxl4SF8GDC+vmtnUyAqnO66G14Sf3pP8rU92ofNhDBGZQy+3jmLQUf9SfCIouLvHu85UC/qhVqsqGt36Ueiii/SAwDynbGtdi90zy5iUQbA/Hi6vGH04zIPtjidNF8VA3f8O8Cq2BpfKzADz3w3nPbv73xwe4EXM/+16oR1+uZnPLjrV80+vSqe7SEELZzV1SD1qSlp3ob4U9oHuxvCPKL5fLGP8dXgm4V15MIZrGipzHkvPYTRa51XSjcDFXwTWBxqpfFuhXqjmszIsnUf8OpkobezDAT+M5leU1/ZFrSBBnVw5yz2KOciYTG3wHgRrCNdRHoVLs76OXtUwNlOabw1hJvBHFbop6nTmhBtX97gngBlWrEvx1ChO5kEUKYRN7CB37t/cj++fmx5KOhJSySYvy2UmizkrNyVS9RLouxvBrrKkbDBa+Vs7MNx20j9784vkpR1c3MII4uhDDW9XgnP1sJkFoCpQwN+pWrfjKWeBMsoPTSCpjs59mEMcsaE3O395UYxuLM8uqGYI9pO+nS5kCpAFhO1y7nGu+ZE6nDLS+fj6w/7lx5J/SfPFIhIDlq4oqKqdmS5e/KhqTxEWgv3b9qQ/NVN1ASxQwV93+vmB8HX1RsO/aiz3XGVom46/JbTeTnKvLV9Ufd7u0Tkx0nEQM6hRQ1dDiwmvo6gru5mN/Q2/rqkC1WWb7oJkNpeT+w+Vna3fMh0eqik4+mZbgbDLNjhCXE+pjoqntxIH94NjbHMMkfBfzOBmydkWxjORTFGqVhhx/bc6DM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7acfce8-318a-4ccc-1c67-08d7f2636ded X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 08:48:35.8225 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mawCAlJgB5sz98iePCwJubWpGELx/YRUKNaXRWjr5nfJ1FyxF5Mhbvt46TExydM9JX/o4CcJuqAxAn1pfc932dW0EYgonzDTae1XRBR4eZY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass client-ip=40.107.8.138; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 04:48:43 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, stefanha@redhat.com, codyprime@gmail.com, sw@weilnetz.de, pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com, ronniesahlberg@gmail.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" qemu-img convert wants to distinguish ZERO which comes from short backing files. unallocated_blocks_are_zero field of bdi is unrelated: space after EOF is always considered to be zero anyway. So, just make post_backing_zero true in case of short backing file. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- qemu-img.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 6a4327aaba..4fe751878b 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1632,7 +1632,6 @@ typedef struct ImgConvertState { BlockBackend *target; bool has_zero_init; bool compressed; - bool unallocated_blocks_are_zero; bool target_is_new; bool target_has_backing; int64_t target_backing_sectors; /* negative if unknown */ @@ -1677,7 +1676,7 @@ static int convert_iteration_sectors(ImgConvertState *s, int64_t sector_num) if (s->target_backing_sectors >= 0) { if (sector_num >= s->target_backing_sectors) { - post_backing_zero = s->unallocated_blocks_are_zero; + post_backing_zero = true; } else if (sector_num + n > s->target_backing_sectors) { /* Split requests around target_backing_sectors (because * starting from there, zeros are handled differently) */ @@ -2580,7 +2579,6 @@ static int img_convert(int argc, char **argv) } else { s.compressed = s.compressed || bdi.needs_compressed_writes; s.cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE; - s.unallocated_blocks_are_zero = bdi.unallocated_blocks_are_zero; } ret = convert_do_copy(&s); From patchwork Thu May 7 08:47:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 283269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E2B1C38A2A for ; Thu, 7 May 2020 08:52:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43BEA2073A for ; Thu, 7 May 2020 08:52:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="BLdMS1JH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43BEA2073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWcGX-0007it-Cz for qemu-devel@archiver.kernel.org; Thu, 07 May 2020 04:52:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDB-0001w5-GM; Thu, 07 May 2020 04:48:57 -0400 Received: from mail-eopbgr80138.outbound.protection.outlook.com ([40.107.8.138]:13902 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcD9-0006Er-JQ; Thu, 07 May 2020 04:48:57 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fw7tTrDKA9Y/W0+CxKbWzVSW14hEb+G7ADguZLCOaPf47m1xmmvNfHhg04+ML88OSLNa6ittAX0gwVXQdDsPGA4YP6onBTk7xzWNGomi2nBLnWLk6cSvHoG5b9Ak3VM6gxa8oGJwVr1ZNU+oMHuBvmuAIEhk7uP7zDEj7KoUGDddckXXCSBzESdPImVYd/o6zBhAKt7XYsArT5ZOwYhPPBWAErbCdMBOBlGUGVUVUc0sOJtAzyalXAKNA9cl46tvsYeftX8UzGMwX7zODr7wsuDYPPEDQzhkhFyI6zfxB19FfLNa6K1gJYQCnnf04FDTD2ry6/+wkcP+JEZuZKmDyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rO/M75YVJtl8je8wd45k4tiRsB6uC+AxB6yt81k+DWk=; b=adR3juPJ+2GRnE5r+uvzkLMhn1UzE06uq7AnceBo9YAYeLCZqwd/ihCx6i9tKz/GjamFtwdrgGEb9ouAIEHjXKbwcvpe+ZiTk+lwWyNJfcIUs58r567kOR17vFlK9yuvcdX0zyq3u6hP9pbGLY1K9R16dLJ8UN74MktbE17u95Igbq7jJJbf3VQDyNzA5vGezPIPRMznJG35PTzDIcynPPsMTzz+fnQpQBIwPF+jdIOejDCDeXO8x27uRMKhZzWiYGtrrgbS+eLSv8xqyuJKfMq8+pDAL+CFVaHIuldCMAgcvASdjDPqLy9gzHRmEf5039jNOsG0/lDFda6DngpFvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rO/M75YVJtl8je8wd45k4tiRsB6uC+AxB6yt81k+DWk=; b=BLdMS1JHIpwxv5g2GKP9GqOkmkrxcJQiTtaIKszm5ExL0WEhlWASZiaLakKHPXiRW27WSjh191GIXDqWvgE9twEy7mquL07z+SC2j9cj4LzQu2dWVcA5d+7ClAPZQUJF66PkA2d852edG2qqB3CkzqHBR8kAJWcummhPY3SuqZE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Thu, 7 May 2020 08:48:37 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.034; Thu, 7 May 2020 08:48:36 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v2 2/9] block: inline bdrv_unallocated_blocks_are_zero() Date: Thu, 7 May 2020 11:47:53 +0300 Message-Id: <20200507084800.20596-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200507084800.20596-1-vsementsov@virtuozzo.com> References: <20200507084800.20596-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.171) by FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26 via Frontend Transport; Thu, 7 May 2020 08:48:35 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec9787d9-be24-4553-d151-08d7f2636e8f X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:549; X-Forefront-PRVS: 03965EFC76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: asrqZ7HfeXrDiUJBtQ1ytAtA9On9gjjGJeVVf/keKtaXpi+cF86lMmGg1oV7zNp1aIWm0D1dXs7OxnO4WotQzNKDq1Ahgdewt2gB0SziRVCcQ1ahO4pigkO43N9n9gBcUDfzoNJNvPDsIj1bswBpglhbxFTKDaGIK7LGEqPpPaf9B0dr8kqGiZ8g+SO1NPma9VwEd06XgrHTMkKPcg+Lara3s1LGhO+d02jWkTma+jx1eUgv1VMdOuzqSp2DR2MtwcywJD6swlDy7b8j2Do7uKubI7uQdGvTkHv23ws1WGPUertDYVyprEGZj7P5XJEj9q/AYl1Nm7ESxQMhale2VaOt6zY4gKFVmlpsxBIzreQaJLlMqGqjYl+BFC4dQbE4xfq1d2E3WyyHoJEQdsZ+aeTEwf0Kf1GMJ/6FhBdyJBxPwpVvTcfDexGS2PjFECAGmD+ladkW83s0vmtQ8Ie32Kvg6HddEgus5KQmVxmteP8Bl/30hulqP+HvcHvCzlIaOAyS3p37HbIl1VI7qEfBmjBHQ/6C2naqGjXjcwqzpndeFpBgUJCB7uaNdXwMvZOh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(39850400004)(396003)(366004)(136003)(33430700001)(4326008)(478600001)(107886003)(66476007)(66946007)(66556008)(5660300002)(69590400007)(2906002)(52116002)(7416002)(6486002)(1076003)(36756003)(86362001)(6512007)(83280400001)(6916009)(186003)(16526019)(83320400001)(956004)(26005)(33440700001)(8676002)(83300400001)(83290400001)(6666004)(2616005)(83310400001)(8936002)(6506007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: W5B4SAzvUtoYl0kD6mXE+l5HYonuN5lQXE+puUxbqzFd1keFJd68iDukjzxpzc7NO7iuEv0fFV4TxDQEGtvIwHGHsbw9a1niuJLhmxzPf4Nr1f1vVNWgFghQzCZVAfIJexIi2T6ckW+HJ83i32MJT46fFgd6DOOBkz0lc/6NiDgKPf94u8Huru0XKj11uiMacA/IolKa/oOJUh5KNHDnN89jWPNsZtGjjsWefgezksqTz5ReAR5fKdYmQVQ2LaeZei3+sASpBX1f29cdMeCzsYILiDry4QsFd+BhHjGqIgSfSa8JFyPjL5q0lK8gdzPZ5tpvusFCmrwiPTQ6nZ9nJkkvZiWWLe/57OIV1HBBWjcgz1iWK9Ow0pSGyXaO0deFj/zeZGOiTqERDWOupq4+F+rQPMVO1tRQBZ/4+9NpKCIAGPKsyb930oX0L7lJ7hnUN+XfEzfVJnOECCa+bybWYSWXT8V1TdbHFaklNnKCoIAu55jBAvsNQDmly9gstcTxOQyPSKU6fidtvMU/yQ7OcgMTjpOISidiRdt9hDY92RM23NrpdlUIRkuKcC47ei6dhCZ+B91lcsj0V/glJD2YNHgQ8EdfCW0wYlL4m1BqP6o4wR3w2nFq2/epBfcHOy0Z1ngaYzkyEmSEQBnPJj4IuZHCXBF50AW67WfsAeDQhDruJIw632cAEqK6WEElD8i8B6jd1Xqf8QEZvXM0ePzsBM/iDXSvRT5VLMXOuj3hGQf1hy3VFPy6ZhTVu5oUX2iiLrwkExEx+G8wKDyJigtRsV9CjzwEFoni2SLfOJHRf2w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec9787d9-be24-4553-d151-08d7f2636e8f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 08:48:36.9127 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T4O8832rIOZpEGhWo9YELOAyOUyA1PHeZc9/WrtURbduvSQrTl0UO2O1mdhYEWqMyJtrWZrqUzy/U97AxIYwpw/hu4JI/p9egu5HjZ4Lj6c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass client-ip=40.107.8.138; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 04:48:43 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, stefanha@redhat.com, codyprime@gmail.com, sw@weilnetz.de, pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com, ronniesahlberg@gmail.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The function has the only user: bdrv_co_block_status(). Inline it to simplify reviewing of the following patches, which will finally drop unallocated_blocks_are_zero field too. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 1 - block.c | 15 --------------- block/io.c | 11 ++++++++--- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 8b62429aa4..931003a476 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -431,7 +431,6 @@ int bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int64_t bytes); int bdrv_has_zero_init_1(BlockDriverState *bs); int bdrv_has_zero_init(BlockDriverState *bs); int bdrv_has_zero_init_truncate(BlockDriverState *bs); -bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs); bool bdrv_can_write_zeroes_with_unmap(BlockDriverState *bs); int bdrv_block_status(BlockDriverState *bs, int64_t offset, int64_t bytes, int64_t *pnum, int64_t *map, diff --git a/block.c b/block.c index cf5c19b1db..0283fdecbc 100644 --- a/block.c +++ b/block.c @@ -5305,21 +5305,6 @@ int bdrv_has_zero_init_truncate(BlockDriverState *bs) return 0; } -bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs) -{ - BlockDriverInfo bdi; - - if (bs->backing) { - return false; - } - - if (bdrv_get_info(bs, &bdi) == 0) { - return bdi.unallocated_blocks_are_zero; - } - - return false; -} - bool bdrv_can_write_zeroes_with_unmap(BlockDriverState *bs) { if (!(bs->open_flags & BDRV_O_UNMAP)) { diff --git a/block/io.c b/block/io.c index a4f9714230..00e7371d50 100644 --- a/block/io.c +++ b/block/io.c @@ -2386,15 +2386,20 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs, if (ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ZERO)) { ret |= BDRV_BLOCK_ALLOCATED; } else if (want_zero) { - if (bdrv_unallocated_blocks_are_zero(bs)) { - ret |= BDRV_BLOCK_ZERO; - } else if (bs->backing) { + if (bs->backing) { BlockDriverState *bs2 = bs->backing->bs; int64_t size2 = bdrv_getlength(bs2); if (size2 >= 0 && offset >= size2) { ret |= BDRV_BLOCK_ZERO; } + } else { + BlockDriverInfo bdi; + int ret2 = bdrv_get_info(bs, &bdi); + + if (ret2 == 0 && bdi.unallocated_blocks_are_zero) { + ret |= BDRV_BLOCK_ZERO; + } } } From patchwork Thu May 7 08:47:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 283271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D7B7C38A24 for ; Thu, 7 May 2020 08:50:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C53C2073A for ; Thu, 7 May 2020 08:50:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="XoxHw4Ep" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C53C2073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWcEP-0003kb-IO for qemu-devel@archiver.kernel.org; Thu, 07 May 2020 04:50:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDC-0001wW-C3; Thu, 07 May 2020 04:48:58 -0400 Received: from mail-eopbgr40111.outbound.protection.outlook.com ([40.107.4.111]:2308 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDB-0006ET-FB; Thu, 07 May 2020 04:48:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PXMAxRhHVSPe8GaY0ug2ibaeqMlyBeWTKzVlHiw2Qo4dqevkUQgslW27hnH51kh8HpcnQ0UEE9klOtsx+CYm5xonCBmfM6j3Qw2HAjOLUMF1qNwi5TTMwp8k30KqIOIcCfESIT3jnCA/Dned/hbkbjU9g+Xzli3anWob513cF0WaRSJO37zGvENSP+jEVHodALLtQqlyUF3691WavFaU/yodXiBkvZsAQy68EoGvv26ETezHQTiG9WKwLG2kxvkFZIzccj/SG6uGOwJNECoUklwa/fkjOlILBIANWzAtdWd2c7QIYoHHFuP9gQN4NVU+CTeRtlMYWCtqJ9xqQxITSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DcbgjCYYvhfsWp15T1RdkWOxF9JlG4jbjmNvT/in/0s=; b=cOZdpyR2FjPiv1kzfWZD7ZG4WU7INPbRulr287T58/scoyJDO1kXeEURNE4FMDskz6EGftbJj/EVyRhpCqk9WOWtHzjGhyALLZK+0SoT7KDqQ2V3iy8ffwaZSPUM/C6q7O2UDPyp73KZLfb+bxkjbmawkQSTv7+ymVkUwhoI2d25hImCz8pPuCMH3cPfbW3qhT5R4quPINOF4CNUjQP9kfvIxZQYEtz90fBXG/A2sE3dW1zvSIpBuCMeyvnmgo7UAduLZTWc+QSohxirjeEwh8k63w7LLYEYJrqYUQz9dY4pgP6D8LQTRIZnd9r6XgG0jh3u1R5wKW/3DQYNvL0Zmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DcbgjCYYvhfsWp15T1RdkWOxF9JlG4jbjmNvT/in/0s=; b=XoxHw4EpTK0YPvahnebBgrdqnX0ReQDs7Ccfi1IwMHshqvQ9+iDzucx3yVQX/k74KO5jL3EUHjpHKIPKPZ4P2h+Ym2mTX7xyabNQnmL4Ak3Ntla5ZKD0kZdOQ/VqAd5Jyccuvz0Ti6vpn18AmAR0EFLpDj0mOKixONsuah9IyyU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Thu, 7 May 2020 08:48:38 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.034; Thu, 7 May 2020 08:48:38 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v2 3/9] block/vdi: return ZERO block-status when appropriate Date: Thu, 7 May 2020 11:47:54 +0300 Message-Id: <20200507084800.20596-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200507084800.20596-1-vsementsov@virtuozzo.com> References: <20200507084800.20596-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.171) by FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26 via Frontend Transport; Thu, 7 May 2020 08:48:37 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38e8a38e-f5a8-4918-5f57-08d7f2636f32 X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-Forefront-PRVS: 03965EFC76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4dmncv1BX6QvOdhpQ5FKAkLfywAv8+Pyt/rhcGiodmc/ZG0xPIQfMcX5hzU4n6HjHVaVqe8zBZSzCtXTYuyuxfYNLXdM2CY+o/M+uG8Qx8VzjKYdPH6CFaBe2BC7hdbA1rI3sGc/vzNC9YT2w15gybJLniTjX5RzjxrCe2YYD34Vz1buy9cS6F7V6NPASyOPUJYo/9R7icqiszYuYlbH+aOlSFP+Uxllp9RDocrMHfq1Sn5CHPxk5RJbGT1vM1B0e3boQWloTK6rEHNmCDKoSDHRzeLNShUTu3YYe7cmwFBCzn77+56fSg27s/TnH15vF3ZN4e5qpKDAc+cLZt7rPacVJjcnWm6QmRgyM07ryOQoad3biHNec2UpEy5DMoj+/0URPA71awsIwf54yER7rS+0OPJ1I2GBdoU0wkdpmi99bRwB12Rp9RqBg8UIXdgTPWJ1yec4qLOH9gosVGzdi/qcgfslNDYl+1ahsSCJjlie+v2APvG4KWnSln6axrS7AeoraXUXblDKoqVaXBF41QcVjIe/fhVL0sf6TlXs4agkVQeonxQwzGEdSukxZ+Z6 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(39850400004)(396003)(366004)(136003)(33430700001)(4326008)(478600001)(107886003)(66476007)(66946007)(66556008)(5660300002)(69590400007)(2906002)(52116002)(7416002)(6486002)(1076003)(36756003)(86362001)(6512007)(83280400001)(6916009)(186003)(16526019)(83320400001)(956004)(26005)(33440700001)(8676002)(83300400001)(83290400001)(6666004)(2616005)(83310400001)(8936002)(6506007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: JyxStYvnbb0oViBzGWvJGFF0VeNYtbgKW7Q0DEGljD2Z2dJR7WQzINJXt3SfncMPOuxkWi759gtFiNqjQjEXCtbctDe2oftlcj6d7V/rDQxssaeU8HjZEWp+oy7ahAsMibpub1fH1ozNNIxF7U1ZkgWnbn56k3qQneyi0zcBlYysImocFJH3d4gsrMIOomko8Yn9s97R5JT+q2ekrlOCG041XxyfbuuhyRqoTa3ce+HGqowIxjEfxcWXrAPtd7mDaT3YxeWN7F9WWB33Ii7Pqm9L8L8Upck9iZO8NpbIiPb5QiS9eU3BqSl5eWk5ygcKpMFb+wsgoC8aTi8XeozQyH8XYarNngU9lDxJ5lPVl9ofdfmCSGL1WXEDZvB7YHcomWe5qY5ykGP7nOIW6IHjbLYwKfeg5HOzsJXUE0x0l8MW1LkWR5FIBICsMKhkuDaZhdITxKIMv0GW2T2wi0QVkv0zRHtlidVLRbRhkPTZu1GIRRRIxXHq84xuTeuDbddZvFwt3CGPz5NiezzvvwlQgMXuSyvkhdnulXUkOQ3GVKK6BLHL4Qb2ZVIwJ6Pdj65dfJs13NoBqjN1711EI9BAuMnLZMEVWZ4VhavQsyBygrpCDeUC85m+WpQR5BTgDIc1yiBneU82BeRwLUa+5XzbW6ST/ZegkSjSjk6h3d+aiuE/2raNzrLnVDkguljyBHRJQuNXLh2ev6869mhQsU2VEjYyK8IiOfsvmD9TtkoEEvqKNYpmrs6Jxcc0LJS9Jp/sG+rOzi/hG82H7DYyE0TQAz+jocwM+gNonlPHNXYQGDo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38e8a38e-f5a8-4918-5f57-08d7f2636f32 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 08:48:38.0188 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qBlkmBzS49Bmv9xFrdfv1c4O3pMHCVMb1D0EP36U6aD0AYpMNvVQ5KHtvpH182ATweqt6JVC/hfMqttKi6j+EoIY+HhzDIPoq7BoLrm11Ew= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass client-ip=40.107.4.111; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-DB5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 04:48:35 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, stefanha@redhat.com, codyprime@gmail.com, sw@weilnetz.de, pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com, ronniesahlberg@gmail.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" In case of !VDI_IS_ALLOCATED[], we do zero out the corresponding chunk of qiov. So, this should be reported as ZERO. Note that this changes visible output of "qemu-img map --output=json" and "qemu-io -c map" commands. For qemu-img map, the change is obvious: we just mark as zero what is really zero. For qemu-io it's less obvious: what was unallocated now is allocated. There is an inconsistency in understanding of unallocated regions in Qemu: backing-supporting format-drivers return 0 block-status to report go-to-backing logic for this area. Some protocol-drivers (iscsi) return 0 to report fs-unallocated-non-zero status (i.e., don't occupy space on disk, read result is undefined). BDRV_BLOCK_ALLOCATED is defined as something more close to go-to-backing logic. Still it is calculated as ZERO | DATA, so 0 from iscsi is treated as unallocated. It doesn't influence backing-chain behavior, as iscsi can't have backing file. But it does influence "qemu-io -c map". We should solve this inconsistency at some future point. Now, let's just make backing-not-supporting format drivers (vdi at this patch and vpc with the following) to behave more like backing-supporting drivers and not report 0 block-status. More over, returning ZERO status is absolutely valid thing, and again, corresponds to how the other format-drivers (backing-supporting) work. After block-status update, it never reports 0, so setting unallocated_blocks_are_zero doesn't make sense (as the only user of it is bdrv_co_block_status and it checks unallocated_blocks_are_zero only for unallocated areas). Drop it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/vdi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index 0c7835ae70..83471528d2 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -334,7 +334,6 @@ static int vdi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) logout("\n"); bdi->cluster_size = s->block_size; bdi->vm_state_offset = 0; - bdi->unallocated_blocks_are_zero = true; return 0; } @@ -536,7 +535,7 @@ static int coroutine_fn vdi_co_block_status(BlockDriverState *bs, *pnum = MIN(s->block_size - index_in_block, bytes); result = VDI_IS_ALLOCATED(bmap_entry); if (!result) { - return 0; + return BDRV_BLOCK_ZERO; } *map = s->header.offset_data + (uint64_t)bmap_entry * s->block_size + From patchwork Thu May 7 08:47:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 283268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABF78C38A2A for ; Thu, 7 May 2020 08:53:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 755C820747 for ; Thu, 7 May 2020 08:53:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="ESqwlr0a" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 755C820747 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWcHh-0001o5-Ku for qemu-devel@archiver.kernel.org; Thu, 07 May 2020 04:53:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDI-000218-4v; Thu, 07 May 2020 04:49:04 -0400 Received: from mail-eopbgr80138.outbound.protection.outlook.com ([40.107.8.138]:13902 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDG-0006Er-3B; Thu, 07 May 2020 04:49:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZwHId9oXgjIFqdinBOwW64a3/9ePKh0xw9TEo1uoADKaoQ96mBi3AzXgOE1F2N9Ojh7C4NMEKKfwYDfIHYsZQIklE8uxVT4BwYVOYTvF+Bw5c4hqbJVKs7ziDjGW90vcW6j8HSrgjmRzG8Sp9kublSmtglU7UOEdfdwxb6g5o7MPvnH8t35EECNX0hT+zQ+V6jJ3FTIjDNhNivk7pLMXISbQzd9NcKcFLlEyJbzVYrK6JRQflSb9s2PWMq1JMSSuDbBvVNIW3+vkA1Q7he6jcZcUO6cBsrFW1LdNSpuNyHeg2Bg1pvZIkG8akCMBdLRhRCfnsu7z5SAc/rzCB9L9og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tEw8sfNryfOBsTwhETT0Gfn5CiFm4JvafjhcfrJ03ao=; b=Lbr7SSH49sL5UUS9J9UQ/qu10eiogU06PfHyoemssb0Wb+vWRQUMtweqY29ds/p9C3zx8jGw3TK7BHyCpMUzHvROnE1xdMhLw+rVbwEWnxh+UXNwWowEmBV7zVFBZwoYQZckwBNCKwnraSz3MkXLhgAwjrOwysQV2jq1wRpmFhK/zE8QK27smgVszrYWFMhL53TAbLjtC+4SzX4r3AXB/SbijKbFAJOpvvdICjHIZK6wxyvKbbFflsmf1qRxIY7nyxNdqz12OLFVOaUav+vZalqSqv073El1pJ+RjrzD6WTgb+7AiVlvGr+IRFMigM/v+pFEFmHWE7yod5Hcvgs7Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tEw8sfNryfOBsTwhETT0Gfn5CiFm4JvafjhcfrJ03ao=; b=ESqwlr0arMmk3hezbxRS3/tTpkUgwrSu1u7raIGeiTUgAgyLb3C50CqAschmIJgDbiBtnllomEEi0BPCVAHVhZxfjWb4RG82zo5mWmdOheBgP6pQh1wwl0T1vnBuxWEtBp3SBC/xO1U2E4NiwJtlyyHT+SKYcaR1FSDDItB879g= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Thu, 7 May 2020 08:48:41 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.034; Thu, 7 May 2020 08:48:41 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v2 6/9] block/iscsi: drop unallocated_blocks_are_zero Date: Thu, 7 May 2020 11:47:57 +0300 Message-Id: <20200507084800.20596-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200507084800.20596-1-vsementsov@virtuozzo.com> References: <20200507084800.20596-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.171) by FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26 via Frontend Transport; Thu, 7 May 2020 08:48:40 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 402c554f-c1ee-400d-7518-08d7f263712f X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:605; X-Forefront-PRVS: 03965EFC76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o0OUJg4JatHM5vLnKMemDx9MPxZgPWujpN/VoVEmG0luJldA+nfwRG4DzMUJF2XMTc/fRA5MAmt4Tfsau+m/4xJ/puTfOXUht58k4ZmYfqWN3OxDYRruAwBWGqQ11n6Ab1OlnYGDmXPMwSvjvoWYDZty3SxYEElp++2WeYj4PtJ0ickkSpBhdKUFGez4LgpcqiQgz+WmQqql8CBH+f8UauXSuAhbWCg/UO4JAOxJMnOhdlVpIjiUWpjPpuubdMPW057EsFWjXgFfl4t2Wg4UyvSTqfqYLrM9HzsOtWw08rjQWdYS1fz2TvSrfzEqI5KLBoP1Kp2iSSWcc/mESJDRLhAZaQx308XjEvnviKY1c9upqq7bxlgzPJEmngEWlBKgAjEf0mcJL/od02PG8dutq23x/WsNbNJT+PDdPUSjhVy6X3CSV1gcNJm/2YhTnjLHbBlF/r5xa0Kckg+48RxwspCktcE4Vyb51Rw7mB/R8aPljlIYH28JwKhfRbAnfJ5hn49hSB7a5b/X18xVWCeW+3RAmZWwNqQTrCwd6IjwBuKoWoMsM4pn6tcCOfDRDzPf X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(39850400004)(396003)(366004)(136003)(33430700001)(4326008)(478600001)(66476007)(66946007)(66556008)(4744005)(5660300002)(69590400007)(2906002)(52116002)(7416002)(6486002)(1076003)(36756003)(86362001)(6512007)(83280400001)(6916009)(186003)(16526019)(83320400001)(956004)(26005)(33440700001)(8676002)(83300400001)(83290400001)(6666004)(2616005)(83310400001)(8936002)(6506007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: O2We9lYFH6kqA2EgSOXAKCme4f/AbyssJMWZZTU2wfUSJsWa2j9egYm7Krf5h6WF82q0311Ssda7dkjq6s1KCfMbUR+smMmuYpddhEAhH+kHnFh3r9uJpNUPUkmk/irpSQ7Tf1ngf8hUOWpyIWfESoAmHf8NP5zyueEQNf/PFMXigKkw8UIMWI+dt294G9EvAhvsp+IjIP8m1WRT2jpXLLCISkVs/BdDlt04fxXtoegpZ9FvmEujSPFFBaDmeEwDenV6+LPdKDPj4laEoeJxC9P0ULG1puqsT8IcmqmJeIf2bHCOcuo00G2G3YZ6ceLIyPOcHSfr64YqtDDd1D4EHwqgQkagV+ZGxCfMvLs8SUc1xUehRAfcew1Rqb2z9fXTMylnVWwrSHKBROXgdpp/9Qix8LDsHJKckAFXY/beWVVFVRrkut4locmLan/YKwp9cy6/cDCHj7nKxPJ3Xll7kDi8e/QXAJIFad/JiNVAq1SSI3zLIh3gjTh1G7tGbH58eT9Giu01qv9rQOgBt977FdoG07Sr5sHE7OYnpVVjLcUrduvuxQ7Eo/pZF/v0TUqKqTKw7e+aZB0dNBxJ+yMqyvW7ZYkejPP0hXxrRJyOXkDluwlN/6wQ2NDbhKUlJTtMGwqmsSdFmBsE0i+WEiGgiTTofsMnVnkzjpdwaKbtxuxyK7ALyTkoFmPDnZs6+YcnBl0mBrbNQS2o3zPPXLwVkn48Y5yaKAkULa13KXfcMXZ/91z8dBi+nJwo1mmrJ/r/IG1m6ltZFEXlbclZx4uXA9cUKLgyRAeontyn57lxcok= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 402c554f-c1ee-400d-7518-08d7f263712f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 08:48:41.3034 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: js4A1ssOGq7Y39cPylSurrY13ZkAAV3yLVY6dziNUu4BmIhsyxr1yfvyVa7/xAf+0oXyQLV3X3+UFgW+1GlUyK/KqygHVS3ahC3SJpViXHM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass client-ip=40.107.8.138; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 04:48:43 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, stefanha@redhat.com, codyprime@gmail.com, sw@weilnetz.de, pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com, ronniesahlberg@gmail.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We set bdi->unallocated_blocks_are_zero = iscsilun->lbprz, but iscsi_co_block_status doesn't return 0 in case of iscsilun->lbprz, it returns ZERO when appropriate. So actually unallocated_blocks_are_zero is useless (it doesn't affect the only user of the field: bdrv_co_block_status()). Drop it now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- block/iscsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/iscsi.c b/block/iscsi.c index a8b76979d8..767e3e75fd 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -2163,7 +2163,6 @@ static int coroutine_fn iscsi_co_truncate(BlockDriverState *bs, int64_t offset, static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { IscsiLun *iscsilun = bs->opaque; - bdi->unallocated_blocks_are_zero = iscsilun->lbprz; bdi->cluster_size = iscsilun->cluster_size; return 0; } From patchwork Thu May 7 08:47:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 283270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45368C38A2A for ; Thu, 7 May 2020 08:52:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 117B62075E for ; Thu, 7 May 2020 08:52:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="XeaNPUpG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 117B62075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWcGG-0007AO-67 for qemu-devel@archiver.kernel.org; Thu, 07 May 2020 04:52:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDI-00021z-II; Thu, 07 May 2020 04:49:04 -0400 Received: from mail-eopbgr40111.outbound.protection.outlook.com ([40.107.4.111]:2308 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWcDH-0006ET-DJ; Thu, 07 May 2020 04:49:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bQYAZgbvcPaICd2r5JsdvgQWjJCzbmPFyeVe235STX/BU61e2FvOutJvvPN7dM7TzNytxBGI4/Yzh9OA1U3vCv0AfaFgZw1wJXRlTmUtsFfgo2QOqrFifoaC39jItUO9PfyNsfQ80m9FIzoVKgjIQJZ7L233qRSP+sl6kRmM+D6Q1AA0oiSvSx88Yx34U1Q/fYKUVXZWxcu1Ao2P8j5I8kpeestijuKQskABgK9ZVXCoQzw3ccLaW4YE9DZ3wFc8R/PywSHfZZxCaWeIyO3esDTGtHgU+J599LdLtk8mKLkO2xtutskRFAD63NOZ1I4NsKT6zWPuhkE2dlDPzFXsLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ELUvFv5R20eBBESfHssSDSiMo/Pt4r/eBrm8poHTVjA=; b=D9tQI7v+it9qbF2biV3MKk/QqcQrqffbYzJISOLY15bFPWpZTEfYJhWhQjMfE7YJkIijrZ95Mq4sZwH1QF2vqyNLw6+YlghncYuj8ij23b49hMC+4jlwDUJntSkiiku4VgSTCAwu9ZchZbEklRiEqNEnDiogEnoirFbj3SFOc7TQGVsGV2SNUveT76A+pR95EwPYuNjeCYQVT6r3wMJ1kuGtZIYqKb++nAnmoT5rUnXwa5bNDIC98Q+Hq3xvK5KOEzqw6wqz/VduoqhulcIP4PioORvBHwUp9WSZTaOVai7IAA7Ifp44BdliXrTCPMbAiJPBD9jif9dnojY4dwR6RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ELUvFv5R20eBBESfHssSDSiMo/Pt4r/eBrm8poHTVjA=; b=XeaNPUpGLaC0tgJR728awZh0S63aQgwdnP+IDJoH0RV1kmR/Bel4KDsWcNVdVi4wGQMqmG3biy7TLIin9+xJ399mXlRoZMe5KMW5QAl64sP+GmdTB2G2d+BxGTGmr+vkCEiedg36tFTAlIBDSZF7X7Htb1wIWFSqkqiupRLA9cE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Thu, 7 May 2020 08:48:42 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.034; Thu, 7 May 2020 08:48:42 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v2 7/9] block/file-posix: drop unallocated_blocks_are_zero Date: Thu, 7 May 2020 11:47:58 +0300 Message-Id: <20200507084800.20596-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200507084800.20596-1-vsementsov@virtuozzo.com> References: <20200507084800.20596-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.171) by FR2P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26 via Frontend Transport; Thu, 7 May 2020 08:48:41 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 031abf18-5639-4035-df98-08d7f26371d6 X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:83; X-Forefront-PRVS: 03965EFC76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Di8X6hBXqZPoSZx+dhBqhW3U4Cfx8WmSB3VQaK06UKvUDO1WLrpm44geqwAKJ4TWr/C4IDQJZMHIVnN4+YvHS6bRJ+XznivWiDso59/KdILP+it+TdcSrpZ7MvGxBs4D2Ro1NAy+KNIKFeaZ4KccJMGFPNPE1H9J3WxxRfCONTb4ARNEWfYXzS48sBhgVVSDOMznkDt0qDq/+VE+YhXpnQh6vYQ0oZsASmEGZanG+XPXaIOhShJAlQ3wHDVqjBsyRC7dB3DhMbgOn46zHHh06OR/DqCs3FM4iS7uqxIugkMnH93TYgI37dTk4gqDfs9IVCPgh43xDSUVbDUELvtzQan57xOsHXcVZ8JoJP2yzZLOCPYFcWSatQhYBfiFvIcMRajyWFuIkkgn8lAXVlZzB2A5mX6eWKD4DGWqCm7c5tXAxDFEO/3M9hvZug8EUMLhjxpjsK+Kg9u8EykagSKp+Jkua6FNRARiwYb0e6AJN88xKvANfHYgfJq0ApYTg4UgB1j+WDPr+Gkq8RusjdOMByZvm/Mvi8RfCtUXTFzj4OPy4D8H4yvitHtsewdCZoy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(39850400004)(396003)(366004)(136003)(33430700001)(4326008)(478600001)(66476007)(66946007)(66556008)(4744005)(5660300002)(69590400007)(2906002)(52116002)(7416002)(6486002)(1076003)(36756003)(86362001)(6512007)(83280400001)(6916009)(186003)(16526019)(83320400001)(956004)(26005)(33440700001)(8676002)(83300400001)(83290400001)(6666004)(2616005)(83310400001)(8936002)(6506007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: nBdx3cRSfA/Mt2QQOitHqz4GDcWodq1EnFXyrUdXBXwskgW/4dN2rabymgMml3xiYXQsZ3XOJikGYb/IW754ISHG87dBgGb0rNnw6myDBAo6I8lx7fPEsF0yoeuaxE7EuAL6NjqAJMKZuMcLzkAEQ7AT3LV/NmZYcejkYBjMpZbqaPnuXghUn10nq9aWs4n76XToKuOt4GiemuEORdGjCHqmkNigHZ1+2qYInPrTXDyZlQtNr6/MA8jAN2LxgPZXHm/jXi/zQCfW3oxgdcYT6XllCcBxcsr6Yrly+UrUtluhoMS+Dz0Ylwk5hLs7Y08N+IkxrNsGwknAr20UeLcJoqljrNYA/nx8HymMeZhVKskbjrov8To8CcCcsx7LecLLimXeeQt90txyYIAqYD5Wl9G2GrPcJjylUKvjBhcQQ34QvQajoAR5SW8jzbPEER5rp4IYI9oVUfdAMhCiJHocm3ediLaxR7/0BavqPN7ShZ/D3Ls+gbD4CUnWKywVAVdjdd8dooT6iIYR1dfz+oT6Zf/HyolqntghioKTyYvjrMEUvIMMTQv4jyCbM5x3Fh5oNf+pMxgjg2DZh9HEGXBZgOX2x/8AYBpFtAZNO4zGkzKk2TTCN8Y76eavGY8zWIaVXiXSFdhYckfwfcpo7HFj+WEUSI2yOfvcVqTJHNjp54fhZZ+yN7p2ReejhAFhfoAuWNv06mrYrb0RA/D00pTj8YqdqlBVIifqPkqpxLuZuIO9Rx3IMMeGMUN7kckfT1lir4W9STCP3KG8lqPaZ4C6Wagdp0ayJPEOf9eDQH/nPYU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 031abf18-5639-4035-df98-08d7f26371d6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 08:48:42.3837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ufqNfO5AXy9bKbMCPxPJ4+HIYyDOU4kl84qeqTDv5ZVbNnWysRmL9n4fpCXU6UWsRc6LI53ElkZeiAjJBoZ1cqzMzFjkxiLJzdHW6PYemxI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass client-ip=40.107.4.111; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-DB5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 04:48:35 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, stefanha@redhat.com, codyprime@gmail.com, sw@weilnetz.de, pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com, ronniesahlberg@gmail.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" raw_co_block_status() in block/file-posix.c never returns 0, so unallocated_blocks_are_zero is useless (it doesn't affect the only user of the field: bdrv_co_block_status()). Drop it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- block/file-posix.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 05e094be29..5c01735108 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2878,9 +2878,6 @@ static int coroutine_fn raw_co_pwrite_zeroes( static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { - BDRVRawState *s = bs->opaque; - - bdi->unallocated_blocks_are_zero = s->discard_zeroes; return 0; } From patchwork Thu May 7 14:45:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 283230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2B12C38A24 for ; Thu, 7 May 2020 14:46:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACBD520575 for ; Thu, 7 May 2020 14:46:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dIImAfmV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACBD520575 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWhnA-0007uC-SN for qemu-devel@archiver.kernel.org; Thu, 07 May 2020 10:46:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWhmJ-00072N-Mx for qemu-devel@nongnu.org; Thu, 07 May 2020 10:45:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21580 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWhmH-0003dR-Ty for qemu-devel@nongnu.org; Thu, 07 May 2020 10:45:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588862732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mD0J+BqA3hH5L2MGfLPWpRGM1gavaMsHDS4Z1HMFV8=; b=dIImAfmVm4Hq5ztONVKR2f+yph+yoA7ayEsTEOfugcDgByZqRZ2+7j++x71qEPlyBj59dr IcU6dBYsrboTX1f1FYioYXVVNWSOCziFilNbfoY+qWR3x5cy0bWX05wSjhiqaC2XsS/ORM nydYzIkxqeY3BELUGdj55rxJBUeZP1s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-O-Z3v2kDNKCZoshuF8wnRA-1; Thu, 07 May 2020 10:45:29 -0400 X-MC-Unique: O-Z3v2kDNKCZoshuF8wnRA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F867460; Thu, 7 May 2020 14:45:28 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-73.phx2.redhat.com [10.3.114.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id A86C15C1B0; Thu, 7 May 2020 14:45:24 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v2 10/9] qed: Simplify backing reads Date: Thu, 7 May 2020 09:45:13 -0500 Message-Id: <20200507144513.348470-1-eblake@redhat.com> In-Reply-To: <20200507084800.20596-1-vsementsov@virtuozzo.com> References: <20200507084800.20596-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=eblake@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 03:15:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, "open list:qed" , stefanha@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The other four drivers that support backing files (qcow, qcow2, parallels, vmdk) all rely on the block layer to populate zeroes when reading beyond EOF of a short backing file. We can simplify the qed code by doing likewise. Signed-off-by: Eric Blake --- I noticed this during my audit that v1 of Vladimir's series was correct. No change in iotests results (test 274 is currently failing for qed, but for other reasons: +Traceback (most recent call last): + File "274", line 24, in + iotests.verify_image_format(supported_fmts=['qcow2']) +AttributeError: module 'iotests' has no attribute 'verify_image_format' ) block/qed.h | 1 - block/qed.c | 64 +++++------------------------------------------------ 2 files changed, 6 insertions(+), 59 deletions(-) diff --git a/block/qed.h b/block/qed.h index 42c115d8220c..3d12bf78d412 100644 --- a/block/qed.h +++ b/block/qed.h @@ -140,7 +140,6 @@ typedef struct QEDAIOCB { /* Current cluster scatter-gather list */ QEMUIOVector cur_qiov; - QEMUIOVector *backing_qiov; uint64_t cur_pos; /* position on block device, in bytes */ uint64_t cur_cluster; /* cluster offset in image file */ unsigned int cur_nclusters; /* number of clusters being accessed */ diff --git a/block/qed.c b/block/qed.c index 927382995a0c..bea4b9f6cc97 100644 --- a/block/qed.c +++ b/block/qed.c @@ -849,56 +849,18 @@ static BDRVQEDState *acb_to_s(QEDAIOCB *acb) * @s: QED state * @pos: Byte position in device * @qiov: Destination I/O vector - * @backing_qiov: Possibly shortened copy of qiov, to be allocated here - * @cb: Completion function - * @opaque: User data for completion function * * This function reads qiov->size bytes starting at pos from the backing file. * If there is no backing file then zeroes are read. */ static int coroutine_fn qed_read_backing_file(BDRVQEDState *s, uint64_t pos, - QEMUIOVector *qiov, - QEMUIOVector **backing_qiov) + QEMUIOVector *qiov) { - uint64_t backing_length = 0; - size_t size; - int ret; - - /* If there is a backing file, get its length. Treat the absence of a - * backing file like a zero length backing file. - */ if (s->bs->backing) { - int64_t l = bdrv_getlength(s->bs->backing->bs); - if (l < 0) { - return l; - } - backing_length = l; - } - - /* Zero all sectors if reading beyond the end of the backing file */ - if (pos >= backing_length || - pos + qiov->size > backing_length) { - qemu_iovec_memset(qiov, 0, 0, qiov->size); - } - - /* Complete now if there are no backing file sectors to read */ - if (pos >= backing_length) { - return 0; - } - - /* If the read straddles the end of the backing file, shorten it */ - size = MIN((uint64_t)backing_length - pos, qiov->size); - - assert(*backing_qiov == NULL); - *backing_qiov = g_new(QEMUIOVector, 1); - qemu_iovec_init(*backing_qiov, qiov->niov); - qemu_iovec_concat(*backing_qiov, qiov, 0, size); - - BLKDBG_EVENT(s->bs->file, BLKDBG_READ_BACKING_AIO); - ret = bdrv_co_preadv(s->bs->backing, pos, size, *backing_qiov, 0); - if (ret < 0) { - return ret; + BLKDBG_EVENT(s->bs->file, BLKDBG_READ_BACKING_AIO); + return bdrv_co_preadv(s->bs->backing, pos, qiov->size, qiov, 0); } + qemu_iovec_memset(qiov, 0, 0, qiov->size); return 0; } @@ -915,7 +877,6 @@ static int coroutine_fn qed_copy_from_backing_file(BDRVQEDState *s, uint64_t offset) { QEMUIOVector qiov; - QEMUIOVector *backing_qiov = NULL; int ret; /* Skip copy entirely if there is no work to do */ @@ -925,13 +886,7 @@ static int coroutine_fn qed_copy_from_backing_file(BDRVQEDState *s, qemu_iovec_init_buf(&qiov, qemu_blockalign(s->bs, len), len); - ret = qed_read_backing_file(s, pos, &qiov, &backing_qiov); - - if (backing_qiov) { - qemu_iovec_destroy(backing_qiov); - g_free(backing_qiov); - backing_qiov = NULL; - } + ret = qed_read_backing_file(s, pos, &qiov); if (ret) { goto out; @@ -1339,8 +1294,7 @@ static int coroutine_fn qed_aio_read_data(void *opaque, int ret, qemu_iovec_memset(&acb->cur_qiov, 0, 0, acb->cur_qiov.size); r = 0; } else if (ret != QED_CLUSTER_FOUND) { - r = qed_read_backing_file(s, acb->cur_pos, &acb->cur_qiov, - &acb->backing_qiov); + r = qed_read_backing_file(s, acb->cur_pos, &acb->cur_qiov); } else { BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO); r = bdrv_co_preadv(bs->file, offset, acb->cur_qiov.size, @@ -1365,12 +1319,6 @@ static int coroutine_fn qed_aio_next_io(QEDAIOCB *acb) while (1) { trace_qed_aio_next_io(s, acb, 0, acb->cur_pos + acb->cur_qiov.size); - if (acb->backing_qiov) { - qemu_iovec_destroy(acb->backing_qiov); - g_free(acb->backing_qiov); - acb->backing_qiov = NULL; - } - acb->qiov_offset += acb->cur_qiov.size; acb->cur_pos += acb->cur_qiov.size; qemu_iovec_reset(&acb->cur_qiov);