From patchwork Mon Mar 3 12:28:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 3754071 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C2659F38E for ; Mon, 3 Mar 2014 12:29:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0847203AF for ; Mon, 3 Mar 2014 12:29:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75E86203AB for ; Mon, 3 Mar 2014 12:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753889AbaCCM3A (ORCPT ); Mon, 3 Mar 2014 07:29:00 -0500 Received: from mail-we0-f169.google.com ([74.125.82.169]:60540 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753834AbaCCM27 (ORCPT ); Mon, 3 Mar 2014 07:28:59 -0500 Received: by mail-we0-f169.google.com with SMTP id w62so1287685wes.28 for ; Mon, 03 Mar 2014 04:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=oEwysCgKOKp59hZ66zrss5pmSFVoE9V++szQ9lxxukk=; b=Nw/o82lxscdXlBcoBCV7Ko8nw25bHKbdC33GYztcYNAVKJ0PmAJN5oXdzFO+RrRBe0 kAHhdPAfZV4dMWWbZs9rEOkh/5KSVQUc92cSB802wLaO8lV+BI3zyDHAwcXUioVCZxCv 1yxfm2iRXd3mw4gPfp/MtEaTOMv7xUnY3SXyW6Oos/4APXROVj7OyALIYDrExKqaL5NM +i+4YjE1nvuRb3YC1cnHEUt9oS72tKSklUx8qXM668Nhhhat3AzkyBV5kd0vFbEe31eY q/4xGPmlEztGM2b7Z5loU+9/GtUgzK0XJzzmQ/LZHPTYId/82aualDRWx58BKn0MUgVN vgQA== X-Received: by 10.194.57.239 with SMTP id l15mr17332422wjq.40.1393849737909; Mon, 03 Mar 2014 04:28:57 -0800 (PST) Received: from storm-desktop.lan (bl13-134-213.dsl.telepac.pt. [85.246.134.213]) by mx.google.com with ESMTPSA id de3sm34535109wjb.8.2014.03.03.04.28.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 04:28:57 -0800 (PST) From: Filipe David Borba Manana To: linux-btrfs@vger.kernel.org Cc: Filipe David Borba Manana Subject: [PATCH] Btrfs: avoid unnecessary utimes update in incremental send Date: Mon, 3 Mar 2014 12:28:40 +0000 Message-Id: <1393849720-32076-1-git-send-email-fdmanana@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we're finishing processing of an inode, if we're dealing with a directory inode that has a pending move/rename operation, we don't need to send a utimes update instruction to the send stream, as we'll do it later after doing the move/rename operation. Therefore we save some time here building paths and doing btree lookups. Signed-off-by: Filipe David Borba Manana --- fs/btrfs/send.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 298e25d..d0e3828 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -4956,18 +4956,19 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end) ret = apply_children_dir_moves(sctx); if (ret) goto out; + /* + * Need to send that every time, no matter if it actually + * changed between the two trees as we have done changes to + * the inode before. If our inode is a directory and it's + * waiting to be moved/renamed, we will send its utimes when + * it's moved/renamed, therefore we don't need to do it here. + */ + sctx->send_progress = sctx->cur_ino + 1; + ret = send_utimes(sctx, sctx->cur_ino, sctx->cur_inode_gen); + if (ret < 0) + goto out; } - /* - * Need to send that every time, no matter if it actually - * changed between the two trees as we have done changes to - * the inode before. - */ - sctx->send_progress = sctx->cur_ino + 1; - ret = send_utimes(sctx, sctx->cur_ino, sctx->cur_inode_gen); - if (ret < 0) - goto out; - out: return ret; }