From patchwork Tue Jul 11 12:40:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Butsykin X-Patchwork-Id: 9834667 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 6DA9F60363 for ; Tue, 11 Jul 2017 12:53:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57CCC26E3E for ; Tue, 11 Jul 2017 12:53:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C33A27861; Tue, 11 Jul 2017 12:53:03 +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=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 65C5826E3E for ; Tue, 11 Jul 2017 12:53:02 +0000 (UTC) Received: from localhost ([::1]:46200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUuez-0004Dj-Ix for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Jul 2017 08:53:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUuXZ-0006OB-S2 for qemu-devel@nongnu.org; Tue, 11 Jul 2017 08:45:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUuXY-0005md-4S for qemu-devel@nongnu.org; Tue, 11 Jul 2017 08:45:21 -0400 Received: from mail-eopbgr30108.outbound.protection.outlook.com ([40.107.3.108]:53030 helo=EUR03-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUuXU-0005jN-1q; Tue, 11 Jul 2017 08:45:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zwxY3Uqqoo/MEm5jFxDfq+LfwyJ9OytfnCsEOYJWbX0=; b=ATpwQV7X/H5frZKfjDXpK1InOwh7ycgZvr5jADSfzP0fjq0dCWT23rrtgl5blnPdKM0BSZcxcro7FXamFb41HEJgCJMPfCPd20hInResdF3duCfzSOE0OYiqDbrgbUfkAwmlGG7XDMaAXZeTXxoD4B4yIbUCn91hslrltA8Me10= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from pavelb-Z68P-DS3.sw.ru (195.214.232.6) by HE1PR0802MB2555.eurprd08.prod.outlook.com (2603:10a6:3:e1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1240.13; Tue, 11 Jul 2017 12:45:13 +0000 From: Pavel Butsykin To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jul 2017 15:40:23 +0300 Message-Id: <20170711124024.1396-4-pbutsykin@virtuozzo.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711124024.1396-1-pbutsykin@virtuozzo.com> References: <20170711124024.1396-1-pbutsykin@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM4PR05CA0001.eurprd05.prod.outlook.com (2603:10a6:205::14) To HE1PR0802MB2555.eurprd08.prod.outlook.com (2603:10a6:3:e1::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84ec76c6-14a2-4386-0a54-08d4c85aad36 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:HE1PR0802MB2555; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2555; 3:Y27QVxtNfbrwqzuNYCqSkU4HLuxhcHljErWcGs3ElLv6mSPIsDlr+6LAwcxv85Z1TGQ2xuuNUeAWaAMNJWAh7QOHC32vvi2OExi5xlvMPnZHP7edNKipMZnj0thgiKN17FtzUE4BaMigxOWywWZ6L/b8KPJbFwc9QRDJbS5zQjtC6L0cLWpS1bgC6vcV1WYSzFFUPVIj+Wz/34j83PCf4cOO1AI6K4bjjziIZzUDHRnbtnl96ZPvgs23Yn2j3/MLm4M2glQjLotwu7EWJvag9b8P4OqbX+41jQDAIOjvXmLbiVZi/MuBzoMlf0vajz1ZAGZeJqgZ1nETgcbGB0lPUOKMqF37LiqdmBAweWBfVw75FrvdYpokcUut7YsA+2kmxnOeMxpUvwcp1MsLY/XgCHkWFUj1DVTku+UIcD1D8tC+PjMBdbnExaX7X2ovOcEDWER38zgHt6vusUTomg1oytGL4+aN7fCYRjP9xJf360xNsq4p25wAN6jkY+pbt4HarPMb6kLZkjPbQDdrRriyZ7WqaQ6/WI6C3QCghS7Ffol6Dcv6fawmeC9xbGJPNnDp40mH/pIuEUdUfN7kx6c7MAaA4P/ONEk4D6iQLDxDHanjfClO4LLUOMvs0Tgl94Da+VrOyFMxc61WqesoJmhjJX3+XwScyKX0YuPIOZzqH1iPum54aibVxxVkNBAj6pLQoPidSsUky2kY40KOaG3Qb1xZMQZ9e82iTzNTWRpO4TQ= X-MS-TrafficTypeDiagnostic: HE1PR0802MB2555: X-Microsoft-Exchange-Diagnostics: 1;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b1aMluDCIY6TCmol4W44MEvQ48QZcfBthZGOc582DZbIk3qxEv1Md9hEiUiKQjz86MycCXgkfVtYiL0UcHy2ulLtqZPL1m+LUz6xtNqjeBcpEVZruGzv9QQNhMSCaBFMBGputtlPLy28Bp94piiex2fyGvrOkvBGMFef5opml/nahpHd+5sZknb8/zsi1m5QiW720CYGmMd+/6TdS/e+YU7sV5wnEy79+/fI4lkM7BSEW8pYMvWGuSSbRNPuhyq/7KkggVkSnYjEO+cvHwfwES4pKYjRk54EdeUBH9kiH3D2HfUpjjuavcdisRhySmiVJ1Es9K2cdb+NmcSzpCObjJkwDOuZgzaN4dsQMLpceH2WK0Eds89L9SJUeF1XWq40NDOrzEyhGpeIAmskgiSf5gYPWH482lhZQTIyUXLqrewlWIh4oZcp02UE8xpT1Y6r59x+cWGrHjPrLr0VOdvaISZIYhJZERMsAIWzfwhNaiCPqsbFYyo2u2Cy+hTDqCOK/igkhATMxFRFb+xVtjUbLeZaKtjMs0av2aZteP02MEZvESJM24qrWOWHIQn8Qdldck/1EqOwWwrHLJs= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2555; 20:aVQpE4Sq04PRFfx+nm04dhXzyZujwBE3xgVOJKfXtODINA5NwwRnGEmsNgrCDJg1IVxZRnNO7mEDUgofBdelVdPRVOmqmV1DC46vcJRFAyc2nMbUB/uMRuq9W75njaP0b3ZQ7YJAFnpax8qvt/8KHLk7XuvEN6MQTDEBNQzc6cxpTv4zgxHD6iF967c9e05wpzNobJtTlOpwfAovgbISionQekVjZxHzf3kVu/pcEwZHUfPSV8nTx63o1KP1U+PTdcD4hbVOIpWedM0Bkog4jCMIlmMeuE8kQ4pNK2GYIaaUN8MOV1D6erVTqiOjFU/VntmfMk0zF+R1fAVvWVa+oGjFKg7It0jGLsmDZqzcEGpvMSdYZX1kLJMbzKV1tHZdpZUlECmV9xhycbZcrGznSEq19ccldMq+Let0YIrnM/Q= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(133145235818549)(236129657087228)(148574349560750)(167848164394848); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(2017060910075)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123555025)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0802MB2555; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0802MB2555; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0802MB2555; 4:isAjS3cYGB34kt2jJuF+A4Ki7yv3i7/k0tYQqoWU?= =?us-ascii?Q?k25AVtgnKhspJQuopc6BigRg7wDIumNwR6dpZdb7tPbds09UDd7LUDhTL48o?= =?us-ascii?Q?T4Vmiteekami2uzFVi4RdNaHs2MmQjRdcMjEJYkWK+xtf9nb8b1QHVfotpR4?= =?us-ascii?Q?F/ZdO54iRiUMzn7ghF6EC/G9ztH0WEhGhCrXrx0V1X3GT/Pmdfigfr6Dd4D9?= =?us-ascii?Q?Ra3UrjTyr2QMYzkZd649QCQzEhNdUh0RMHsS1P0ND6sw0pwHmAWh8z+ssomI?= =?us-ascii?Q?sWYEcANiE/0YsTosMHRGYg+9ikzM8xRDuCvotBdAPjfGGQOFC7oi1/mz0d7W?= =?us-ascii?Q?Q/KooXZQTQYDz7sRaMF31D/z+oZExR4VMR2EPeFijGa65Cm+PPBV0YXImUtG?= =?us-ascii?Q?lzDVBZHoqVYihaB6zK/jW6meTYzy0BkcF4ovFnOSGDtZPDLh6m5KQHIXNYpH?= =?us-ascii?Q?no1xu5fx+Pop1YK+UsZbOCYUGKmKOuxJolNmVj06n2RosMYNfAy3rP4QeoPK?= =?us-ascii?Q?ur8Vv6ylLDgmeaIrheNKxUyiHJuxS+eJWApi4DUpmZzZIQeHz7X8frg5Ebrm?= =?us-ascii?Q?GdQsxTRaecrsc86Hvb6FjD7imEUcM/OAoS8iJjJDHWbvmNKd46+wCqMJyLPR?= =?us-ascii?Q?iGbLtp9yjZ3v2DkCok8btz9B0qLimAGFRm0ntqeIsfgFlEIMnCcInwLt7klf?= =?us-ascii?Q?Vi4OUbAkl6aUqUcFPZMo9RAZqbF+4rrhR6bcAQgHlJ5vtDduDuPgEGvPGiJo?= =?us-ascii?Q?e2M4BWtCbirTE3RU8JPX3WcRwK602dbueyCp/AEb8lnYqPW75U6uhplViohn?= =?us-ascii?Q?bqfV4mcGZTD6GeByyU33rCSCqbuHTCli4sAZO/KSu/xu/21zkz+c9r+eSkhj?= =?us-ascii?Q?bNTL1zgf5jNO0psFpQ80lhoO7BnGN2J+EJ8QeiNm/l35F5M1D8XfjfyV6jYt?= =?us-ascii?Q?H0lHurlZGlIw+UJxId/KANR/uyPikGszQ/QDabZ0eEmjFpkQS0Gai9LxCyqy?= =?us-ascii?Q?+aSeqfm4Vxhzb7h2CW8gQqInFv8KApl7KzKBH6L+pYj1rXkQz5A4anWMA2k1?= =?us-ascii?Q?LDMp71GW4q0ARqvj6LFNXDYmrV7pSKrR2iV2LSsFYBNk5GXtvklt/u2dfFQx?= =?us-ascii?Q?1x09EhZP16NGd9/iHnDq1hxBsBDORWLXepkbyzzDex+YUl8YZKhhJo6j95nt?= =?us-ascii?Q?KJ/R6V7zj8rAvqOr1NL8UD27i2JkT1Qh/4tWWPfxhU1N1ey040BfK9skU+Tk?= =?us-ascii?Q?PQahCuymXybZ7sYakluxosohp+ta1DJYG03DyMxrHnjMjCLNKUYl8qHVdIxq?= =?us-ascii?Q?xLaISnEiWbJpDTe562DnxatN7PvwGs4NeJcVmOAJyBHE?= X-Forefront-PRVS: 0365C0E14B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(7370300001)(6009001)(39450400003)(39830400002)(39400400002)(39410400002)(6666003)(2906002)(478600001)(5003940100001)(86362001)(5660300001)(2950100002)(36756003)(8676002)(50226002)(575784001)(1076002)(50466002)(6506006)(6512007)(53936002)(6486002)(50986999)(48376002)(76176999)(7736002)(6116002)(305945005)(53416004)(3846002)(42186005)(33646002)(81166006)(7350300001)(4326008)(25786009)(110136004)(38730400002)(189998001)(66066001)(47776003)(107886003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0802MB2555; H:pavelb-Z68P-DS3.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0802MB2555; 23:CLydZ2Xj3ZEYbJ258OEgtSq491aI47718LhRIyz?= =?us-ascii?Q?+1fb9ThOLocQ5Cyr376jwJH/uDpRXe+BB4Sb2dT/XeRmpCQc60JvZz8dbu2C?= =?us-ascii?Q?pBgVBn50Y+W4jkLzWHPWNX4ZiQnxf1GGLENXuIfhjy323aKt5uOCxa+QPTqU?= =?us-ascii?Q?cJPOu3zH1INN0O0iiUYzzFsbhzUUEW1v7ZAOXh+rQDwZ8K20LdGx5Epr8u9Y?= =?us-ascii?Q?AYHh9n+Y1dgKIyR7lVMp09f2DPuwvWcyvjY/tVcYa38QlANsaRldjm5JMHXr?= =?us-ascii?Q?Tc92U0iXxu+dt5oC4R7G81pJclQQ12bOsIHdXdc2CM/IEWyfpoNl3EkaBYBi?= =?us-ascii?Q?Xmo0shnYDddLtvot4CsVv7OOn/X5Uj8etCuf0D5Q+ur2AbV+mCyJ81Oo370V?= =?us-ascii?Q?GBDgkeWjh1hbhevWbV01bficyp4/zgm3ba4WwRB3APf6q+71qxj/f3nj0Ke8?= =?us-ascii?Q?MgIhTt/jF7/4cJs1vtyMadJ5YAN/LWQJ2c5zLvmjgyr1dqFr1fY/vtzb34lG?= =?us-ascii?Q?zfORRkdfsJKB9dKYuBJX3lNY0wBTuexHaOxXWVF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u9oByEHV099/9RYJSL6dYyWZmEyRNKb4+CZ3N5shrFpMkBykl+rltUos/fKN1RYx0ikcESpEfWXUXsOgITS9/Np9hQorQAL2+rjk6RXRP2PvuM/nuzehQD5MAcrwMqqTS/0ZkaDJUGQSJ9hexfVq3Gkr7wB3kwrzv/xVOekh3sHYO2gVIUJ7ALYocKwB48ftJD2qsx1MVeg3XVW0DNuKg7zistYplgZakshf8ZIMclMum/KG0l89hTeW74zKzZ9XCI+dclMXKDPomKufklR30KAu/Ae8WAMWYyRxzleh6LdViwywaUOcegSTYp/CUxq8QFScI95WulsrCu945e2Fao= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2555; 20:+Z2Pbgz6HiIg6SlX1gar+nCtIR03NX8h+3zvotMb6lF1pctuL7GveRh9KN/quIpylxsfukgws9eAxfsWAOOCaQouF/W/X9gFYSAWZT267BDGpLSVzcvhNAzr0ZFzLWlqccQ9DR6C/M0R76FY9/XO0FQxvn8qIgR8El8BBiwXJyM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2017 12:45:13.5788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2555 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.3.108 Subject: [Qemu-devel] [PATCH v4 3/4] qcow2: add shrink image support 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: kwolf@redhat.com, pbutsykin@virtuozzo.com, armbru@redhat.com, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch add shrinking of the image file for qcow2. As a result, this allows us to reduce the virtual image size and free up space on the disk without copying the image. Image can be fragmented and shrink is done by punching holes in the image file. Signed-off-by: Pavel Butsykin Reviewed-by: Max Reitz --- block/qcow2-cluster.c | 40 ++++++++++++++++++ block/qcow2-refcount.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ block/qcow2.c | 42 ++++++++++++++----- block/qcow2.h | 14 +++++++ qapi/block-core.json | 3 +- 5 files changed, 198 insertions(+), 11 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 3d341fd9cb..04d48878af 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -32,6 +32,46 @@ #include "qemu/bswap.h" #include "trace.h" +int qcow2_shrink_l1_table(BlockDriverState *bs, uint64_t exact_size) +{ + BDRVQcow2State *s = bs->opaque; + int new_l1_size, i, ret; + + if (exact_size >= s->l1_size) { + return 0; + } + + new_l1_size = exact_size; + +#ifdef DEBUG_ALLOC2 + fprintf(stderr, "shrink l1_table from %d to %d\n", s->l1_size, new_l1_size); +#endif + + BLKDBG_EVENT(bs->file, BLKDBG_L1_SHRINK_WRITE_TABLE); + ret = bdrv_pwrite_zeroes(bs->file, s->l1_table_offset + + sizeof(uint64_t) * new_l1_size, + (s->l1_size - new_l1_size) * sizeof(uint64_t), 0); + if (ret < 0) { + return ret; + } + + ret = bdrv_flush(bs->file->bs); + if (ret < 0) { + return ret; + } + + BLKDBG_EVENT(bs->file, BLKDBG_L1_SHRINK_FREE_L2_CLUSTERS); + for (i = s->l1_size - 1; i > new_l1_size - 1; i--) { + if ((s->l1_table[i] & L1E_OFFSET_MASK) == 0) { + continue; + } + qcow2_free_clusters(bs, s->l1_table[i] & L1E_OFFSET_MASK, + s->cluster_size, QCOW2_DISCARD_ALWAYS); + s->l1_table[i] = 0; + } + return 0; +} + int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, bool exact_size) { diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 0141c9cbe7..e52d1698b5 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -29,6 +29,7 @@ #include "block/qcow2.h" #include "qemu/range.h" #include "qemu/bswap.h" +#include "qemu/cutils.h" static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size); static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, @@ -2945,3 +2946,112 @@ done: qemu_vfree(new_refblock); return ret; } + +int qcow2_shrink_reftable(BlockDriverState *bs) +{ + BDRVQcow2State *s = bs->opaque; + uint64_t *reftable_tmp = + g_try_malloc(sizeof(uint64_t) * s->refcount_table_size); + int i, ret; + + if (s->refcount_table_size && reftable_tmp == NULL) { + return -ENOMEM; + } + + for (i = 0; i < s->refcount_table_size; i++) { + int64_t refblock_offs = s->refcount_table[i] & REFT_OFFSET_MASK; + void *refblock; + bool unused_block; + + if (refblock_offs == 0) { + reftable_tmp[i] = 0; + continue; + } + ret = qcow2_cache_get(bs, s->refcount_block_cache, refblock_offs, + &refblock); + if (ret < 0) { + goto out; + } + + /* the refblock has own reference */ + if (i == offset_to_reftable_index(s, refblock_offs)) { + uint64_t block_index = (refblock_offs >> s->cluster_bits) & + (s->refcount_block_size - 1); + uint64_t refcount = s->get_refcount(refblock, block_index); + + s->set_refcount(refblock, block_index, 0); + + unused_block = buffer_is_zero(refblock, s->cluster_size); + + s->set_refcount(refblock, block_index, refcount); + } else { + unused_block = buffer_is_zero(refblock, s->cluster_size); + } + qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + + reftable_tmp[i] = unused_block ? 0 : cpu_to_be64(s->refcount_table[i]); + } + + ret = bdrv_pwrite_sync(bs->file, s->refcount_table_offset, reftable_tmp, + sizeof(uint64_t) * s->refcount_table_size); + if (ret < 0) { + goto out; + } + + for (i = 0; i < s->refcount_table_size; i++) { + if (s->refcount_table[i] && !reftable_tmp[i]) { + uint64_t discard_offs = s->refcount_table[i] & REFT_OFFSET_MASK; + uint64_t refblock_offs = get_refblock_offset(s, discard_offs); + uint64_t cluster_index = discard_offs >> s->cluster_bits; + uint32_t block_index = cluster_index & (s->refcount_block_size - 1); + void *refblock; + + assert(discard_offs != 0); + + ret = qcow2_cache_get(bs, s->refcount_block_cache, refblock_offs, + &refblock); + if (ret < 0) { + goto out; + } + + if (s->get_refcount(refblock, block_index) != 1) { + qcow2_signal_corruption(bs, true, -1, -1, "Invalid refcount:" + " refblock offset %#" PRIx64 + ", reftable index %d" + ", block offset %#" PRIx64 + ", refcount %#" PRIx64, + refblock_offs, i, discard_offs, + s->get_refcount(refblock, block_index)); + qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + ret = -EINVAL; + goto out; + } + s->set_refcount(refblock, block_index, 0); + + qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache, refblock); + + qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + + if (cluster_index < s->free_cluster_index) { + s->free_cluster_index = cluster_index; + } + + refblock = qcow2_cache_is_table_offset(bs, s->refcount_block_cache, + discard_offs); + if (refblock) { + /* discard refblock from the cache if refblock is cached */ + qcow2_cache_discard(bs, s->refcount_block_cache, refblock); + } + update_refcount_discard(bs, discard_offs, s->cluster_size); + s->refcount_table[i] = 0; + } + } + + if (!s->cache_discards) { + qcow2_process_discards(bs, ret); + } + +out: + g_free(reftable_tmp); + return ret; +} diff --git a/block/qcow2.c b/block/qcow2.c index 2f94f0326e..c7506ed971 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2589,6 +2589,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, Error **errp) { BDRVQcow2State *s = bs->opaque; int64_t new_l1_size; + uint64_t total_size; int ret; if (offset & 511) { @@ -2602,17 +2603,38 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, Error **errp) return -ENOTSUP; } - /* shrinking is currently not supported */ - if (offset < bs->total_sectors * 512) { - error_setg(errp, "qcow2 doesn't support shrinking images yet"); - return -ENOTSUP; - } - new_l1_size = size_to_l1(s, offset); - ret = qcow2_grow_l1_table(bs, new_l1_size, true); - if (ret < 0) { - error_setg_errno(errp, -ret, "Failed to grow the L1 table"); - return ret; + total_size = bs->total_sectors << BDRV_SECTOR_BITS; + + if (offset < total_size) { + ret = qcow2_cluster_discard(bs, ROUND_UP(offset, s->cluster_size), + total_size - ROUND_UP(offset, + s->cluster_size), + QCOW2_DISCARD_ALWAYS, true); + if (ret < 0) { + error_setg_errno(errp, -ret, "Failed to discard cropped clusters"); + return ret; + } + + ret = qcow2_shrink_l1_table(bs, new_l1_size); + if (ret < 0) { + error_setg_errno(errp, -ret, + "Failed to reduce the number of L2 tables"); + return ret; + } + + ret = qcow2_shrink_reftable(bs); + if (ret < 0) { + error_setg_errno(errp, -ret, + "Failed to discard unused refblocks"); + return ret; + } + } else { + ret = qcow2_grow_l1_table(bs, new_l1_size, true); + if (ret < 0) { + error_setg_errno(errp, -ret, "Failed to grow the L1 table"); + return ret; + } } /* write updated header.size */ diff --git a/block/qcow2.h b/block/qcow2.h index bf6691dbd0..82e83dc0d5 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -488,6 +488,18 @@ static inline uint64_t refcount_diff(uint64_t r1, uint64_t r2) return r1 > r2 ? r1 - r2 : r2 - r1; } +static inline +uint32_t offset_to_reftable_index(BDRVQcow2State *s, uint64_t offset) +{ + return offset >> (s->refcount_block_bits + s->cluster_bits); +} + +static inline uint64_t get_refblock_offset(BDRVQcow2State *s, uint64_t offset) +{ + uint32_t index = offset_to_reftable_index(s, offset); + return s->refcount_table[index] & REFT_OFFSET_MASK; +} + /* qcow2.c functions */ int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov, int64_t sector_num, int nb_sectors); @@ -538,10 +550,12 @@ int qcow2_pre_write_overlap_check(BlockDriverState *bs, int ign, int64_t offset, int qcow2_change_refcount_order(BlockDriverState *bs, int refcount_order, BlockDriverAmendStatusCB *status_cb, void *cb_opaque, Error **errp); +int qcow2_shrink_reftable(BlockDriverState *bs); /* qcow2-cluster.c functions */ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, bool exact_size); +int qcow2_shrink_l1_table(BlockDriverState *bs, uint64_t max_size); int qcow2_write_l1_entry(BlockDriverState *bs, int l1_index); int qcow2_decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset); int qcow2_encrypt_sectors(BDRVQcow2State *s, int64_t sector_num, diff --git a/qapi/block-core.json b/qapi/block-core.json index f85c2235c7..bcbffa3339 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2372,7 +2372,8 @@ 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os', 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head', 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev', - 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] } + 'pwritev_zero', 'pwritev_done', 'empty_image_prepare', + 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters' ] } ## # @BlkdebugInjectErrorOptions: