From patchwork Tue Jan 17 22:31: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: 9522057 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 2D98E6020B for ; Tue, 17 Jan 2017 22:41:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 200DB28592 for ; Tue, 17 Jan 2017 22:41:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12049285F0; Tue, 17 Jan 2017 22:41:42 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 A35F028592 for ; Tue, 17 Jan 2017 22:41:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751393AbdAQWlk (ORCPT ); Tue, 17 Jan 2017 17:41:40 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36058 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbdAQWlh (ORCPT ); Tue, 17 Jan 2017 17:41:37 -0500 Received: by mail-wm0-f65.google.com with SMTP id r126so42002461wmr.3 for ; Tue, 17 Jan 2017 14:41:32 -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=iPLy99CNUMAksZl1UklVqlz0lP991f/Iq7LRQapSLT0=; b=hAZVwpuNels/ItSNr+l4sMXfijI7ppZ19G/oLEG3zCbaDFGgLMNM2qGsuFAbYMbALB wxy7YDp+QYQ7R5bs0Pf3AJHjbY/yIQGw2XUGrLFt7zkdo4k2rjNNahz63Zr4AIEEmoCb 9bRsa/AJSkjV7Ey3BPgt9aRnKjLjqIyYAl6hFAM98MOzpBIXMPg4V9kCLZOanluXA/pg 5nuuA9KB7mR7jM8jfh7CrWwYo2/6JImhwDw9pv7qBigyeAXHvnb+GXRynPl6Ce3i+0YY VS/p4F8cdFs7Y1bG5Te1E5Z90yTHmImB1dhsGk2bTjWyOL2YSw4IkRssPsm2ZtG4yUst UrFQ== 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=iPLy99CNUMAksZl1UklVqlz0lP991f/Iq7LRQapSLT0=; b=qlfGANWmZAsHIYBGyUxoFrrnoBK2EIKPrkvY+n58xiHmJefeys35x7A7ZwirRGhQEq 4/3yOW3rTUakV4zOlZWzLP8boL3oa0kRxR3p5ypJzZlPtSnswuiIoo3HKT4jZMU+PqaG 0hPdVTuQxT8PCTp3NOZJJiWhT1CZlCMrMEaFDqEgARl46lO4XFYdkWctA72QHcNdacr7 2xD+ObX/zrF/cn3u7fJEQpy664kYP8sDB7U9r7unvnldTpj2/JNXFubreNytzs5g52pA FULYncyIkINdwq3Gfg2VUoD06lvRStREzI8XeJLvhyZVbz8ze775qhm7ieel+helAcXO NxBw== X-Gm-Message-State: AIkVDXIJV9MCcMKrTKEYz/aUCCRUosjtOfPPkWCDmy0ZNahWGCWvhH++jsWIWzVBhDLURQ== X-Received: by 10.28.184.198 with SMTP id i189mr16815538wmf.26.1484692328856; Tue, 17 Jan 2017 14:32:08 -0800 (PST) Received: from fisk.lan (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id w197sm39980489wmd.11.2017.01.17.14.32.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 14:32:07 -0800 (PST) From: Nikolay Borisov To: dsterba@suse.cz Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCHv2 05/24] btrfs: Make btrfs_log_new_name take btrfs_inode Date: Wed, 18 Jan 2017 00:31:31 +0200 Message-Id: <1484692310-3987-6-git-send-email-n.borisov.lkml@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484692310-3987-1-git-send-email-n.borisov.lkml@gmail.com> References: <20170117161550.GW12081@twin.jikos.cz> <1484692310-3987-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 9442c80fe551..41b1e2ed63b4 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); @@ -9660,13 +9660,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; } @@ -9932,7 +9932,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 37adad5dabd6..df822908f2be 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -5809,30 +5809,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