From patchwork Thu Sep 28 09:27:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Butsykin X-Patchwork-Id: 9975577 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 283E760568 for ; Thu, 28 Sep 2017 09:31:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1946529587 for ; Thu, 28 Sep 2017 09:31:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1797429593; Thu, 28 Sep 2017 09:31:36 +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 82686295C3 for ; Thu, 28 Sep 2017 09:31:09 +0000 (UTC) Received: from localhost ([::1]:58154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxV9w-0001SS-GD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Sep 2017 05:31:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxV91-0001PY-GC for qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:30:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxV8v-0008Vb-LI for qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:30:11 -0400 Received: from mail-eopbgr30134.outbound.protection.outlook.com ([40.107.3.134]:12038 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 1dxV8p-0008GW-GU; Thu, 28 Sep 2017 05:29:59 -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=Z7CiFeD+nt7m9Z/0xBrm2zSlhqEP6ubfl7fOGSrl9SM=; b=J004YEimGKWp5ZFeGDWrf5EpDEgbk7E90Atm5TYV3pI229tC3MDufMXLh7aHPi6DsDF4V+KJ1B5cB1KqWtmN3V7Ff+m6VVwyM6oGDIf79nCnJ3MyjXSf8zSpjTiu2nZ4Acw0I7IB2J07mtKLfx1go3nwk8+V1sTNmKOOgXwFo88= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pbutsykin@virtuozzo.com; Received: from pavelb-Z68P-DS3.sw.ru (195.214.232.6) by VI1PR0802MB2557.eurprd08.prod.outlook.com (2603:10a6:800:ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 09:29:56 +0000 From: Pavel Butsykin To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 28 Sep 2017 12:27:49 +0300 Message-Id: <20170928092750.24938-2-pbutsykin@virtuozzo.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170928092750.24938-1-pbutsykin@virtuozzo.com> References: <20170928092750.24938-1-pbutsykin@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR1001CA0048.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::34) To VI1PR0802MB2557.eurprd08.prod.outlook.com (2603:10a6:800:ae::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e737503b-9255-499b-5378-08d506537bd9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:VI1PR0802MB2557; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2557; 3:/LqF4I2VDth+xpFE3dzke7tkfA8tqCJX6AgGmN4TEjQ0d+8y9yXiiqvHPxAU/eMGnZJtSIfF8RQCmux9v9lLk+VDHgSb/EeK2B9HUtBDuaLQILYIaX8ot4BMFYmaiZwx5UZ5FmDDN49Eb3+UGQDOPfwIqL9u4l4oy8Da9ECllVmDxL+KM1sPlkDZ9bVqilELnD4Z5NVkA/Ut61cQmhfGP3N9GDlBwRlpi9MfSxbPBo4lslZcIDKZ3lpNjJLXYEJ2; 25:8gItcsPd0yP8EOAnyC8+obNQasPnaZN+CerXFagWWDS+iFcLgvb1raLzkW/J08aZIENlaVb2Jj6bm2XWqOvvkSapeHSJW6CAIbxjF3VXm3p55P3yo6hpZ+fXb+wL1auRKIV/1cB/oLzQv7O7frSFMELKU9FQVoe6zHLccpN3UAZ3mpnsyd+LtHzmPytJntKzc08TDk9MdtYgmm4naRxKmxeZkdQD7DWohq9f1izRx9wOtSsVnwc8OqiZpom1w/s/W4TkYJIwFAAV41BWIdsLdeLFofzeuz6oNlYJSMGrCyDk8QAZu77WDxlPm7BetggfRxBjmgTfw0irgVq+pD3muQ==; 31:/bzipEMYGhSdH/1wRHq43ghS9efZ/IOoddhu0lTYExvtZlEXGMQXmo/X1NbJIjegWDPAbbXvjVlxGramxox35Xr856SzxIa3h0dlyUVE7Vhewr/vfWpBJEjcCNTH10Qt1qIiDy+j2ic2UCF5pT8rMb5EnjRhmcjSw1wFni2oFDLjabbyDQtTRXXL5n8Ni82KjZBI4bCTkSaJ/2PZLSJ9RnEMvHunOX05Kw3KldoM23w= X-MS-TrafficTypeDiagnostic: VI1PR0802MB2557: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2557; 20:UfsrJCorejOgs2SXpEgeMXzPUMDN8Phphc2AMlHukEkNMkP0KWeimkyM6vJi4yNfJtrQxW9pAkThVlny17cb/qY1Y87S5roedO/hwP9+zcJhU2HSrA1HKnZQoCu/C/w4/LZMQZw2WN9U/eLqccVC4Uxba8hlOxD3zjucxHVBtel/cGMgm92jnH0T8b+gb2UzfDKr5jYQzH0NGL7O8piay4seaOssznzSyUO1UBZV+tvNBnzBNHtINishmdnaJSjPClQueg1m1tUQmFnEb1EH+csJBs2tZkNah44waM9oFvbk92Z5sWvB4stxJ9fX0XrUN/emBKTUd215hhicC7P5OJA5t6ZpyuvKfMCCNvcAxYSaUJnp8PGq7hqxwGHfA1ynqkiBv5/gKXlM1r3MkI84TaNROCmfw+9lJoej6YHvtHU=; 4:XQh7azBavIIkyOIZ7gkbGiNAo/mvw0I9rsZadR08Jv7x6KfTR4rScfkKk0n0BWOboSfWZgJoQFhho8KRoYA/YAwO6z6OmeQABE9dBhLaQLK1UCkeqIJv+9eFZgzMqS8g2rem5sbl3iqCAkeWPIYt0IEnQc6x9ImImGvX0TDLyZbgd2MZDOK1BsWQorHS6h/JKeYqgdDCrlRoBTOWDo0NIVQtuPhq6BU6rz1PzvKcAJorw6Gpx3idvCQSjw1PT8xx X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0802MB2557; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0802MB2557; X-Forefront-PRVS: 0444EB1997 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(199003)(189002)(16526017)(50986999)(478600001)(6486002)(86362001)(50226002)(6506006)(106356001)(316002)(66066001)(105586002)(47776003)(189998001)(5003940100001)(5660300001)(33646002)(7736002)(53936002)(97736004)(16586007)(76176999)(101416001)(305945005)(6666003)(107886003)(69596002)(4326008)(68736007)(2906002)(2950100002)(1076002)(48376002)(50466002)(53416004)(6512007)(8936002)(25786009)(6116002)(3846002)(81166006)(8676002)(81156014)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0802MB2557; H:pavelb-Z68P-DS3.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0802MB2557; 23:W7v91ZWWRcZxyk60phX3U+x3Q5j2kDSMV/92jVw?= =?us-ascii?Q?acMji0x6SDDXN9nkFpwnYOFHZQr//UkVkBtArRrZmKQRHH8fUZr3skk50gsI?= =?us-ascii?Q?v3CgFLQD+8pUv50sIODA1sdtWBArvUawn1LEKt+hw0IIP5C0hf+rTkn8khQo?= =?us-ascii?Q?P2uOtJKxonHMlr0Cs9/mXIQgube6G3D4o7BphkVz7TO8HQ3RIc0qcU0DIQPR?= =?us-ascii?Q?kx8C8tL3ZSXrmnAg85JexzON7NwVpibk1RJTYc67ExwC632jUSjrNWfoezYy?= =?us-ascii?Q?rl4rNQYpCiYyxIGhyH4mbWvM3vhdS3c0ME+e5y9EK/vCkbQNbhvSzWZLlIrs?= =?us-ascii?Q?gX2dnCPI5zwl7JVMyUj/lEpAPH8YsAohzQVhDyV32WNEEl283uRB0uPmlOuj?= =?us-ascii?Q?eU9u6qzo51eVElyV8tSgMi+ra+jB0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0e0X7ZUbfrKn3OgbYwSGIjtmFqud+bGkOhSN2hNMPMEgxEzRvWbfgyCDKHIJ5osmHF1TsqdzwCv1BX9wQ/Vo63iveZCyCWU8P+ertmZZvOEY17s/x2VvepHQjRNIOh9CZ9egHlJNo+A/mrNu7F0CXeOWtHfVfDFJNvBv6vpSmb24+K4cg==; 5:6LjTCS/Y5kPaKdTs5Ek+19qzox2GmJp7uLt0F9u6K+nhoGNVnAfvxr5xHNoCzuNKtZnaAnXy8/rD3TYIHeDKKkKGoZdjsp1xzBnFbLp+u+U95bRzo1qMjN0LtS5YpqKNI87bqqycxLnXE1Pg3hNppA==; 24:DV7Nt2EvI73LgvfDCD2aNPOVxylh2HIoS7tAbITW4TDA8mn46jhURqc5z77K/v591dq0g4Gve5nxMGg7hJxkaV/mbpoGwO61QRNfjLS5ovw=; 7:3vsOOZiA/jfB3uAKkTwSoMT5G33+7S4nTDYsMhpRfD8fJu656aS2lZJErMu+YipE/8pm8IW2wcTLyKi/5M3jcXP4Hp4v/yGWycXRF7jze74HmFK1AaOZnkPcpTmOkzdiB4H3W7f4UJlThGUgW0Re7wiAjEYhNrbNYwrzCtNbBWA39wC8Qa6PQdi/BBBi08jnZG4Yz6ANTEm0tCRfW9svSkk3ohuct7lO9h5O+bbESVo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2557; 20:iyq/jQV/pDmhOjs/EvmfU8gwwTmI5OTEiT6DENMKClNb2E3ydUM+eW5BA+ve114Y1qEnZ2BfqUIck6Sq8wY0l7Ot84CpsDhxVuKr/lvUaBsx6rocjvnSf3uIjfyatmchTg7C/sP15zvpsC6Ejf1y1j9CSlTyMR88igpT5uTpwv4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 09:29:56.2373 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2557 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.3.134 Subject: [Qemu-devel] [PATCH v3 1/2] qcow2: fix return error code in qcow2_truncate() 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, mreitz@redhat.com, den@openvz.org, 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 Signed-off-by: Pavel Butsykin Reviewed-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Max Reitz --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 2174a84d1f..8a4311d338 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3166,7 +3166,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, if (old_file_size < 0) { error_setg_errno(errp, -old_file_size, "Failed to inquire current file length"); - return ret; + return old_file_size; } nb_new_data_clusters = DIV_ROUND_UP(offset - old_length, @@ -3195,7 +3195,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, if (allocation_start < 0) { error_setg_errno(errp, -allocation_start, "Failed to resize refcount structures"); - return -allocation_start; + return allocation_start; } clusters_allocated = qcow2_alloc_clusters_at(bs, allocation_start,