From patchwork Wed Aug 8 22:11:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5F5C1390 for ; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D71E52AF13 for ; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA64E2B05E; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,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 5C6992AF13 for ; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) Received: from localhost ([::1]:45699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWkX-0004rm-KD for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:16:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgp-0002YH-6L for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWgl-0002Eo-6Z for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:23 -0400 Received: from mail-co1nam03on0100.outbound.protection.outlook.com ([104.47.40.100]:12992 helo=NAM03-CO1-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 1fnWgk-0002DZ-Sj; Wed, 08 Aug 2018 18:12:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vxNrlCEhkZCb0niCXitytWU6AqNbQuFVDdYGR0RKpiA=; b=qPOPPzyWUAGrzmny4i0ZW9OTa+Ktr99dQlUHWFQtGUArX3v2AbCYvaB/A8kR+cdHTVCbTjSQBM/jPrHjk1Hwsno1+7prY/ej9tS/xSaEo4sYc+BNCGfmOS2pWUstVW4zOwyTt9R5pM7X5qDvTkUSMC4BYQ0hBIL6snzIdCvBJFE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 22:12:14 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:38 +0300 Message-Id: <20180808221138.5770-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808221138.5770-1-lbloch@janustech.com> References: <20180808221138.5770-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e69f5565-7896-470b-53ef-08d5fd7c0073 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:LijGJtl5Js1pEbP80BXEszOM16jyJ1QI3cOSUlvmwqi7vPuU7vWaAz9H56j/uyhVVv1WzEOIqBqeRGx0jwqBGiSTW7Fm/MXRgN7cYc7Yn2ljfyz007Fc1A44oMNzVN0pzTxfGf6X/lc9nLpLTRkiNF1Y05X/pwqTzeuM7q5AfgboSJJlvTaO0LpaG29PyOyN4qmseKgyK/wuGvoWhUt+I4GsfA8Zy8xknlEvHRFrkFY9ClSCwzhiLqbn+TvdCnXH; 25:jK/1IyUNfwJB+i8/P3ie9SXrhwNtoMr96vnWmmW2WixZpqXB+zXf3b4JP3yiBTRKg6fRa7fmHbbZhmKYxeSCN3xk1oqHhnFCGJ9+KqM/eeTIIKBmzzCN1MDh8J+ROygOlfe0q1POogsV1biflS/s5qffHpHtw6h5xpilZ0JgqENDm1sitbZaTkExJbjsKyNbb3nnsU6k+owFoODV3eK56x4XNnlDYpKbrxKukz3gVZ7FG2fsCCpRLLaJrjBlF4zyHiIxeD1x8shHl6X72mEWhiLZTaPPIh956qdx79lxsGZjgublpyIJ27K9YXbcjAiZ9g3+xofh6iqyFPsf99TxSA==; 31:Af5U1EMkoFF2QmOiZweEMFDF+MiubyPUkT8xIsbNXrbdwZQ3qOYyA+cqmv1S2ukbwERaD+xSP9YrS6F3RwAm4lQXf4EJQiSD8yf+Vlal5uEfd9ijeorKaZfnu3B0IAn1lRh8S6Haw/Cq73t9jhM2LNdH5U24SgB2FnK8NLSB9KRqbcAc2hiyCfMHiDwunZ31h+y9x8rkFH/q3Bn6krK+TCe2Qd4YiU91l/4Y/mLum3s= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:B5SfbZuu7ybdis7GGtR/t0a74ePn+jrIJcZEjV9eDV3UiMpLZCrVaEf0lgVmDR0vbqycOlxomWg6lh3U4iDurhdA7ZT8gtJ8SXMlrsXFSyqBljq3CAjnunGTDczPGtz5twIoDWI4Tsm6GPQtsvsont3VHEPE+wM28VybUhEJ+J9AcU24p2ubZOjS19yDhUQr4q8m6oRdOLuIZeNx3PvBypJfXxC5aWibySpZd55BbIvR9qGrAjPA1eLGylD4Jb9+TtyQ18P64Lo0GUtzP0lDoQ== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(11346002)(47776003)(14444005)(446003)(81166006)(8936002)(16526019)(76176011)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(6486002)(50226002)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2620; 23:jgl8u5FkQbHJtLEZgC7EhwFHnQ4OhkamaUoY0FLvp?= q1hT/b2eOO+l6CvHyjU0GpUINgqvfZRwzJsJ8NcyMJSTwOSxcd323gDYvMfTBrZImPppZGzy18Eco02Uh+omvoKvh52hAGl07n7dF4y3ju3n2NPQvBKfWTd3imjuDtZ8jAGg1VAwBD0rZoARNHyHQDrSFzxiJMekPw+MWGxNeqlqtJ+B8rmQq2j+r3jGgrPomyOibArnl2BUpFNAZWrUFw3n2ojXwGiKAits4eJIqsqzk7PI4xcEK6wi04g7YEJO/ENFWtd0Uu6MjSWRVY2vD7oWa4eV2HJ3m5r7DkFG02yC/yr/X2KzCSMypM/cxtJ8CKZGnWNGio9mgQQCAUGtjdYWemwZI9mXi/xq06IJLSbjdifzCKseCrwa2S+oE4y/ZXC5jvxjZJ8cZ+jeEmetLh5xtwcfX9TIi/vt9DKC6WPUo3FOYvaBXIjhe25GFUA40Es1gJ4EHA3t2N3YTJ0JTUzavi1uHT+WEjU54Xi1CTyOZYvaBn7z2upted3GJoU1gxIyAZJposSkzZlBInwRrgDopF+eEl/l/BtVbgSICZqos9rUeuvPxGRZjjjVLNSlrtjmK5WWAV2g0XBUz7LJ4bZldLr7azc17gMj6pJ0HOiFElLXDFOJH2pujlNUwJpNH6znY6JI9gVJWhO7FoB16iE9oL3z60nuh5UhVGmBlh/4kTyO3gwjTuK9nWPpk8sHF/tj2C4YBzKSo4zkPZvhTkrFnGhGn7Gf50/VENH6qE8YyWouZMZXMzcxhiO5eORxFcEw4vTrvZsfuN+9vuHVZCmBR78A2nNooBEwfmJcF/+YnHGCX8y3Hp3RmOq6HxfN1f8tTMv3zqCynBFbjm+42MDKLCCPPkFyj4tqQhqwRM0c8glQrFCI1cpG3qCVENselt1v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6w+fe6yhzsQ+9FKMzfRjY0qJcNgk3Zbzi0DP4jYPy+SzA4uxT0Baop08xy2H0TXaHam6l/5rUR/P9ULZMpelxzaLmtPrfurtVM8EXRnY1k+PuHJci5Uxe1fRbUQ1JKqTMd0e2dlF+wkBmhRp9MKnjch+rK7EQOKEThw6DMAgdEQnmyLWQTeYoyszEeQ==; 5:Ej9FYaz9jGm6xfi3xf4LOKeH9esG/WRfvfu8Q0EmQ0QgoFG5erokXKMXUlVK39JobhqYdNO87UAQLn3z772SHKPxbCVIvyyE6EuD35/ycK+8DVGhDUQQqOLAeX1mva1n4jx3mOMztTw3YAT/HJvdHiUPZNXy1tMUMWNraCvOWgY=; 7:p4DZmOTwDdNkWIe5HOlAaNCCY2wilQwI7V2/lYafj5Qu5UZrTnT59iUw2qTVZ8WUUzUYhgmZq2qlXbRqLaIsMjSUfjLKFmgbYlfta7viaJPFpXQtNcvWfXMZZjXEenQuKTKtLNRaayYavoTSiXHZauEsJO9YfC9bxeYHwGrna9NOcfwIm3NvwnK4C+GikK7yo5XmwNnfIFk7HJldIcyj8Nvokpd8AbffEAsl5XuquGU0FoySSbPzfZhy2JnZ+fxc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:14.9667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e69f5565-7896-470b-53ef-08d5fd7c0073 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.100 Subject: [Qemu-devel] [PATCH v4 5/5] qcow2: Explicit number replaced by a constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch 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: Leonid Bloch --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 15d849d1f0..0d9d20e46b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1321,7 +1321,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, /* 2^(s->refcount_order - 3) is the refcount width in bytes */ s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; - bs->total_sectors = header.size / 512; + bs->total_sectors = header.size / BDRV_SECTOR_SIZE; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; @@ -3447,7 +3447,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, goto fail; } - old_length = bs->total_sectors * 512; + old_length = bs->total_sectors * BDRV_SECTOR_SIZE; new_l1_size = size_to_l1(s, offset); if (offset < old_length) {