From patchwork Sat Mar 25 11:18:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashijeet Acharya X-Patchwork-Id: 743460 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vqyXn6tglz9s7R for ; Sat, 25 Mar 2017 22:21:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MaqTKBbL"; dkim-atps=neutral Received: from localhost ([::1]:36742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crjl9-000351-42 for incoming@patchwork.ozlabs.org; Sat, 25 Mar 2017 07:21:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crjiA-0001AK-H6 for qemu-devel@nongnu.org; Sat, 25 Mar 2017 07:18:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crji7-0000p6-Ek for qemu-devel@nongnu.org; Sat, 25 Mar 2017 07:18:22 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:36219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1crji7-0000p0-9D; Sat, 25 Mar 2017 07:18:19 -0400 Received: by mail-pg0-x242.google.com with SMTP id 81so2544345pgh.3; Sat, 25 Mar 2017 04:18:19 -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=xmAvbiK6IHDtP0hifSMWIuAskjnZ1ZW/lZfePpBbvOY=; b=MaqTKBbLJRFz5Lr3IGh4M/3u+dqvUoujnaRlrnsw4/igXOV+9IWCozurXZUY9zw8tl +qjPFZjavOaUN633e3jxB+Av6HPggp5ojNMJzo5i0VQEhbRqFggHM8iQSu/6JB3n3VvU r1REPi3dHvvP2ZukEad0fXojCmTw2JezQZz2bURcO+cdRtRimKHDunXrqLyHK37C2J+S H8AnSPS26YH8+hS6qnnbr1ZlUYgW8vaWKtu82FgMUfkb9xsdjuixb+8AIS3Uo591luN3 JJa/D0dgrbm4/8ikh1VW0eRMHFw9O1bPVtkyqKV3gR2WobVlPjOMVcLsnfjjt9IxBTBd 0SWA== 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=xmAvbiK6IHDtP0hifSMWIuAskjnZ1ZW/lZfePpBbvOY=; b=nvb/BRnxSRAD6Xr6hw4L4SbEZZ3Q7/RMU8yh71WgsGhId6n0fHMeskog0PDZzXNrwG AStxJh8Uk6hzvSTZjpRHOobNOFRjbhqWFMvwf68miaonsCpVy83P3FKwG9t7b9tMaky5 LAQkaQlSrv/WVoKWUxXrorPGTWI8K3WwqbXK/lBNv7CAFDwscjhv5sAm3ceCojF3+VFF Cs9aLCeWeT2+eugaMdDRzYCrktCcxt0bVogr5KcDMogxWavTU6P8a4dcNSPk494YNXwa R28lCWFAKmCsnFwLuklr+NtWSfHE4neYiPhT0pgz7REgetqyJlB442ql2NXV8b20CXnl OpJQ== X-Gm-Message-State: AFeK/H1MmDczBEbPMwkW1F1LCPXmW7HavL22ExllwSFwZ1ArFA5OADbke0q2GW/Qpmo1+Q== X-Received: by 10.98.55.66 with SMTP id e63mr15026691pfa.100.1490440698371; Sat, 25 Mar 2017 04:18:18 -0700 (PDT) Received: from linux.local ([27.251.197.196]) by smtp.gmail.com with ESMTPSA id p189sm9952620pfb.128.2017.03.25.04.18.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Mar 2017 04:18:17 -0700 (PDT) From: Ashijeet Acharya To: famz@redhat.com Date: Sat, 25 Mar 2017 16:48:16 +0530 Message-Id: <1490440701-12037-3-git-send-email-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1490440701-12037-1-git-send-email-ashijeetacharya@gmail.com> References: <1490440701-12037-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 v2 2/7] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- block/vmdk.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 7795c5f..f5fda2c 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1036,8 +1036,8 @@ static void vmdk_refresh_limits(BlockDriverState *bs, Error **errp) } } -/** - * get_whole_cluster +/* + * vmdk_perform_cow * * Copy backing file's cluster that covers @sector_num, otherwise write zero, * to the cluster at @cluster_sector_num. @@ -1045,13 +1045,18 @@ static void vmdk_refresh_limits(BlockDriverState *bs, Error **errp) * If @skip_start_sector < @skip_end_sector, the relative range * [@skip_start_sector, @skip_end_sector) is not copied or written, and leave * 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 = VMDK_OK; int64_t cluster_bytes;