From patchwork Thu Jan 12 14:00:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9513255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 690C260710 for ; Thu, 12 Jan 2017 14:01:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B5DB286D5 for ; Thu, 12 Jan 2017 14:01:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 505E0286DA; Thu, 12 Jan 2017 14:01:15 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E80DF286D5 for ; Thu, 12 Jan 2017 14:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751035AbdALOBM (ORCPT ); Thu, 12 Jan 2017 09:01:12 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35575 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750914AbdALOBE (ORCPT ); Thu, 12 Jan 2017 09:01:04 -0500 Received: by mail-wm0-f65.google.com with SMTP id l2so3918561wml.2 for ; Thu, 12 Jan 2017 06:01:01 -0800 (PST) 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=tT2vfOsKngSyo8Q4gEhk6kd6j5rRpnRkHPEdbFbp6ak=; b=N7DHuacvhwU/Y+gFXXw0iBHsn11vyYNrZJoAs7YiKGGiNrNl0tex21dft4f2SsQKK0 9/vKNlatCG5Zxae7CrPG2btzMlYtvXDIAUBkIrDPhN/ex2iFNBi0ysN35WpXQDoN/+7Y yEVxkylPELxntzDLDP6W6Y7d4pFGda8cLzXz2Ix9SF/roV0GehZniHbo+LdQzeISGbFF mvMqn9sbBkOkzSxKZqKx1Yf7mZpbjEpK68OKfijwbMMhR8yf6k9TrWopqT9kNBDBRFKx dZB+MonxTpf4rztnvrbZd0sKZkPvNLrYbX6Vz2Nx/wf5BXa5pqFSRVR1JD/Lf21zGAXQ 7DDQ== 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=tT2vfOsKngSyo8Q4gEhk6kd6j5rRpnRkHPEdbFbp6ak=; b=F8GdYJUl0g/8i1LjWSm73ACn6+a3ft5rf9sEsjbNIhZrJ3MhqPvHfmd46OqoEo5p43 LAp4K21/gowgn6+WqiWPnCuI2hSlFhJw9fA6SVmLYNm+uJBl7DIXEen2QbXM9PeTfLxj G0r8TuRWOD68r0rb6RFK5HP2AKtlADrR/KqhSx/W4KwnlVKEbXSa7GtT1yaeYYc+BS2s uLL0Z5vvaLeYK5+WvJXndFhpRGKjDQS47Z3O+XTk7RlgCJjACcXNQnN3EQldqw4C1OXC i/jegSJSpUQ3GwJWqw1Wyj6QGxf/K1G367nlW6oZOWxscrcxnfWwRbAkCTUL6mYwAxiK wF9A== X-Gm-Message-State: AIkVDXJ/bXgWdyz6lP7x3C1uRAESMey0u/A/mCDC26r92HltSlq1+92iC5KXNwOvn8vVmw== X-Received: by 10.28.57.193 with SMTP id g184mr8150896wma.122.1484229660156; Thu, 12 Jan 2017 06:01:00 -0800 (PST) Received: from fisk.lan (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id y145sm725670wmc.17.2017.01.12.06.00.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Jan 2017 06:00:59 -0800 (PST) From: Nikolay Borisov To: dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCH 05/24] btrfs: Make btrfs_log_new_name take btrfs_inode Date: Thu, 12 Jan 2017 16:00:31 +0200 Message-Id: <1484229650-24554-6-git-send-email-n.borisov.lkml@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484229650-24554-1-git-send-email-n.borisov.lkml@gmail.com> References: <1484229650-24554-1-git-send-email-n.borisov.lkml@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nikolay Borisov --- fs/btrfs/inode.c | 8 ++++---- fs/btrfs/tree-log.c | 18 ++++++++---------- fs/btrfs/tree-log.h | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c2835d0b7098..131669ca1f07 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6600,7 +6600,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, goto fail; } d_instantiate(dentry, inode); - btrfs_log_new_name(trans, inode, NULL, parent); + btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent); } btrfs_balance_delayed_items(fs_info); @@ -9653,13 +9653,13 @@ static int btrfs_rename_exchange(struct inode *old_dir, if (root_log_pinned) { parent = new_dentry->d_parent; - btrfs_log_new_name(trans, old_inode, old_dir, parent); + btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent); btrfs_end_log_trans(root); root_log_pinned = false; } if (dest_log_pinned) { parent = old_dentry->d_parent; - btrfs_log_new_name(trans, new_inode, new_dir, parent); + btrfs_log_new_name(trans, BTRFS_I(new_inode), BTRFS_I(new_dir), parent); btrfs_end_log_trans(dest); dest_log_pinned = false; } @@ -9925,7 +9925,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, if (log_pinned) { struct dentry *parent = new_dentry->d_parent; - btrfs_log_new_name(trans, old_inode, old_dir, parent); + btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent); btrfs_end_log_trans(root); log_pinned = false; } diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 806e0ffc9150..f37194700f3a 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -5802,30 +5802,28 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, * full transaction commit is required. */ int btrfs_log_new_name(struct btrfs_trans_handle *trans, - struct inode *inode, struct inode *old_dir, + struct btrfs_inode *inode, struct btrfs_inode *old_dir, struct dentry *parent) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); - struct btrfs_root * root = BTRFS_I(inode)->root; + struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_root * root = inode->root; /* * this will force the logging code to walk the dentry chain * up for the file */ - if (S_ISREG(inode->i_mode)) - BTRFS_I(inode)->last_unlink_trans = trans->transid; + if (S_ISREG(inode->vfs_inode.i_mode)) + inode->last_unlink_trans = trans->transid; /* * if this inode hasn't been logged and directory we're renaming it * from hasn't been logged, we don't need to log it */ - if (BTRFS_I(inode)->logged_trans <= - fs_info->last_trans_committed && - (!old_dir || BTRFS_I(old_dir)->logged_trans <= - fs_info->last_trans_committed)) + if (inode->logged_trans <= fs_info->last_trans_committed && + (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) return 0; - return btrfs_log_inode_parent(trans, root, inode, parent, 0, + return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0, LLONG_MAX, 1, NULL); } diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index e08ce78b2ad4..2bcbac7efa9c 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h @@ -85,6 +85,6 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, struct btrfs_inode *dir); int btrfs_log_new_name(struct btrfs_trans_handle *trans, - struct inode *inode, struct inode *old_dir, + struct btrfs_inode *inode, struct btrfs_inode *old_dir, struct dentry *parent); #endif