From nobody Mon Feb 9 01:16:07 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.zohomail.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 150755400336053.956979694322854; Mon, 9 Oct 2017 06:00:03 -0700 (PDT) Received: from localhost ([::1]:57754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1Xf6-0002Kf-Kc for importer@patchew.org; Mon, 09 Oct 2017 09:00:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1Xcz-0000vu-E1 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 08:57:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1Xcw-0001uB-Bt for qemu-devel@nongnu.org; Mon, 09 Oct 2017 08:57:49 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:38443) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1Xcw-0001tl-6I; Mon, 09 Oct 2017 08:57:46 -0400 Received: by mail-pf0-x241.google.com with SMTP id a7so27578465pfj.5; Mon, 09 Oct 2017 05:57:45 -0700 (PDT) Received: from localhost.localdomain ([27.251.197.195]) by smtp.gmail.com with ESMTPSA id d190sm14781283pgc.11.2017.10.09.05.57.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 05:57:44 -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=1L9xKHQYG5gN46lYSOyf0FOOeRTfMpCyylacb0myeII=; b=qyv7sgxWG1QOauI0daBr0qFd2MKqih2UE1Ng8ha8B+fsndBwRBkeSCF7EW9cfRvESU KUOk215/5BC7gnWzYxOptD+Dbl7JwNAQAIHyO2xirmf0v1/UrbOMMDDBEjGDC+DxoZMV HIL3+4F+K3N8zwN6R0T3Kz1FJ9xaV2ZCACV34hOkNyOY8yF7XAR5dP7EuHEOtReBqtXi ES5rzGhApzR17/Q1cpW3iXfxfFD+1Bx6ODmu4f9oZIJO7+dCO29MrRSowcMpuumih4Lh WKQtJJofZeV49H8P9Xe8ADYvHqrTJsRifQkX1Jvg46w84DzeF7hDrW5Gr72vA2B11fqN PqZw== 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=1L9xKHQYG5gN46lYSOyf0FOOeRTfMpCyylacb0myeII=; b=QtRVkuyfo6sZk3uTgOoVlCzmQjIyVyFv2WcMI84Fg0opmyBnqHEbttMajH9nfjP+dm 4/mgUNsyopw7YhB3ne0TyZL/ujCIBpGmRAWkwZahB2NbWfM5vA1L00jrCYzz0FKZHdSG FrafnZtBs+JWRNr6gLruMRC5L2ov+cII043SUkrrEbfciUYTX4FVnfYZrLQRm45zJQ1E fLO4Er+mYsunVKL7is9LhEqwgSFUW6qsN38QIF6kNBQ73r/09S1dgtDc9pLb6XcCO7BI tDVzrm3Cb1I+DiD+ZLbh4cNhRMRXREVQH6GBvyKuxLzGznkPVSCOBkMZT5cGbgNLJdBY k2IA== X-Gm-Message-State: AMCzsaXKk2/Bq4qFwL2TjkvJlP/oIxvYVlZkOBcisNNyG3SmCr9nxwuB togp4sHOg9A9lzzJvdxzr7OrLA== X-Google-Smtp-Source: AOwi7QBLRs2FYBT1e8wOKCR690iL3RiU1i3wVfdAOnbvrBJv5x4nz3LoOiOcxfCgW6Bkn/T9yC+WAQ== X-Received: by 10.101.85.4 with SMTP id f4mr9059719pgr.10.1507553865180; Mon, 09 Oct 2017 05:57:45 -0700 (PDT) From: Ashijeet Acharya To: famz@redhat.com Date: Mon, 9 Oct 2017 18:29:34 +0530 Message-Id: <20171009125940.24220-3-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20171009125940.24220-1-ashijeetacharya@gmail.com> References: <20171009125940.24220-1-ashijeetacharya@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH v9 2/8] 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 e86ca39ff2..109c589b43 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1045,8 +1045,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. @@ -1054,13 +1054,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; @@ -1261,7 +1266,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.13.5