From nobody Sat Feb 7 05:49:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491057974218304.0722648084959; Sat, 1 Apr 2017 07:46:14 -0700 (PDT) Received: from localhost ([::1]:51693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuKI8-0007Dx-RD for importer@patchew.org; Sat, 01 Apr 2017 10:46:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuKGQ-0005vo-Ko for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:44:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuKGP-0003yD-Iz for qemu-devel@nongnu.org; Sat, 01 Apr 2017 10:44:26 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:33313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuKGP-0003xb-CZ; Sat, 01 Apr 2017 10:44:25 -0400 Received: by mail-pg0-x242.google.com with SMTP id 79so22400431pgf.0; Sat, 01 Apr 2017 07:44:25 -0700 (PDT) Received: from linux.local ([27.251.197.196]) by smtp.gmail.com with ESMTPSA id h14sm9618461pgn.64.2017.04.01.07.44.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Apr 2017 07:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FPSZpNKpzIRPSXpKydMDE7vfOSTZnnMPzTbo92Nrq+8=; b=WQWzSlAI3GqjI9puKDCfQCjl/aqB1ZV8GC7rLBwY8UOJRrNcWrKYF8qz+L0501fM8f Ormh9oGKIRPg/FoDL8QyMiuyQj3ULTCnjf5vPASoe5/wTGrdKMInmc1sCj2ooqVaqATN zh6JKLH8P+iacG67xUgIIrxJuQ9Cwcbq6aYKDPkMNQAwNzdcsTWG+IFuswXWo+L9KPxU cCkB2dT/9GQdpFQQAtzHqh4JqGl51RZhZUOHo3NB8l3c9DJwW7j6pV/wMNPi3FaBtVYA 7/F/inJtzwe4nKITXqdLDXYlx+u4P9cJ8bLJJBvzTiJ3kCVpYISSTu2nwBH8l98EGP0c LJ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FPSZpNKpzIRPSXpKydMDE7vfOSTZnnMPzTbo92Nrq+8=; b=JpkV6v+59iDuQd1KXYEWEbxRcZZgkDCf47m2MMWTuYv0vxswtpvJIiIMhu85AbYutT 4mswNGcNsxlCeYCXwM0wnrCYuEXV1Jb1oiHey6g/gZkfj0W1GdYOokeOD09OQCpEJUCh xQ84kT2WSnN2WfS5nkGOyxDeu9BLhOljHyrrzXSutIuYfiLj/e1OnLHjbOlvPFBDDvQl P7HR6vG2B1v085w9Hx7FTUXTgIM/r3wSY12qL5V5a6twd0D5wBfiqcrH1V13xux8luc6 E42fGYSt3VX9McJEhI74VQu3PN0P3GOxtfb2dHJjrnjyO617sDZpWyLxkm+EeS4jZp+u zpxw== X-Gm-Message-State: AFeK/H0VEFjd1Fdvwjo+Km2pDyeAM8CQbb6rHID6sUGbDngdn0QTbhKR03DJTgLVJoK9zw== X-Received: by 10.84.233.143 with SMTP id l15mr9741690plk.93.1491057864445; Sat, 01 Apr 2017 07:44:24 -0700 (PDT) From: Ashijeet Acharya To: famz@redhat.com Date: Sat, 1 Apr 2017 20:14:34 +0530 Message-Id: <1491057878-27868-3-git-send-email-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1491057878-27868-1-git-send-email-ashijeetacharya@gmail.com> References: <1491057878-27868-1-git-send-email-ashijeetacharya@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH v3 2/6] vmdk: Rename get_whole_cluster() to vmdk_perform_cow() 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, qemu-block@nongnu.org, stefanha@gmail.com, qemu-devel@nongnu.org, mreitz@redhat.com, Ashijeet Acharya , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Rename the existing function get_whole_cluster() to vmdk_perform_cow() as its sole purpose is to perform COW for the first and the last allocated clusters if needed. Signed-off-by: Ashijeet Acharya Reviewed-by: Fam Zheng --- block/vmdk.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 22be887..73ae786 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1028,8 +1028,8 @@ static void vmdk_refresh_limits(BlockDriverState *bs,= Error **errp) } } =20 -/** - * get_whole_cluster +/* + * vmdk_perform_cow * * Copy backing file's cluster that covers @sector_num, otherwise write ze= ro, * to the cluster at @cluster_sector_num. @@ -1037,13 +1037,18 @@ static void vmdk_refresh_limits(BlockDriverState *b= s, Error **errp) * If @skip_start_sector < @skip_end_sector, the relative range * [@skip_start_sector, @skip_end_sector) is not copied or written, and le= ave * it for call to write user data in the request. + * + * Returns: + * VMDK_OK: on success + * + * VMDK_ERROR: in error cases */ -static int get_whole_cluster(BlockDriverState *bs, - VmdkExtent *extent, - uint64_t cluster_offset, - uint64_t offset, - uint64_t skip_start_bytes, - uint64_t skip_end_bytes) +static int vmdk_perform_cow(BlockDriverState *bs, + VmdkExtent *extent, + uint64_t cluster_offset, + uint64_t offset, + uint64_t skip_start_bytes, + uint64_t skip_end_bytes) { int ret =3D VMDK_OK; int64_t cluster_bytes; @@ -1244,7 +1249,7 @@ static int get_cluster_offset(BlockDriverState *bs, * This problem may occur because of insufficient space on host di= sk * or inappropriate VM shutdown. */ - ret =3D get_whole_cluster(bs, extent, cluster_sector * BDRV_SECTOR= _SIZE, + ret =3D vmdk_perform_cow(bs, extent, cluster_sector * BDRV_SECTOR_= SIZE, offset, skip_start_bytes, skip_end_bytes); if (ret) { return ret; --=20 2.6.2