From patchwork Fri Feb 17 14:43:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579991 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 A9006600F6 for ; Fri, 17 Feb 2017 14:44:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9943C286F3 for ; Fri, 17 Feb 2017 14:44:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E20F286F7; Fri, 17 Feb 2017 14:44:39 +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 258B1286F5 for ; Fri, 17 Feb 2017 14:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934554AbdBQOoW (ORCPT ); Fri, 17 Feb 2017 09:44:22 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35153 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934382AbdBQOoU (ORCPT ); Fri, 17 Feb 2017 09:44:20 -0500 Received: by mail-wr0-f193.google.com with SMTP id q39so5487916wrb.2 for ; Fri, 17 Feb 2017 06:44:19 -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=xbya+cWpoXLX8xNePfrna0bxa1zZH5D1yTUhhIMaxYc=; b=NYdzJAjFIayX7vljBRxovLdDEi596RMREdNOW+92kOsquhBnqMuSbNJjvV1/qsRhvq O34hF2O2BGKvESEPu4czaE4DCBbsmCJSUW881HfX32vOiRxme3+bYkID+Hs0yzkjm0Cd WxCnST5WuFY0i5k+iW7FePfa7NJ3I2QvC3g49kSM6bdKgMhHqnA8W4I875NDCpP8mTAi x6GU8oOC4wblD9S8T3glsabYd0/GJuSRGrcgzzJlr76QkuuJU0oUUYTxexTDupEWkvkb gfqT/emmffSm5qcn0Jkt0vTLUsn4Xry3aGFcJE4/Q5lj6HXoRmhTM9TiJnPwn49Yc6Pc ZPSw== 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=xbya+cWpoXLX8xNePfrna0bxa1zZH5D1yTUhhIMaxYc=; b=DvOJ+Z+VxhEJCAk4ahnQ8dG3GzAt9RSmcZYStsvS5oDxC7XMawYoWAeEMyjE+744sl Gw17SjY1JSd8wx1r9gT38aElJYcagcjVF7v9sJMkuaHh1LGvKN/T2s2mI6eNg5wV9jxj sBECTsiE1CPPzv3YmGatW3mcsNwRXWkM1VyT7qBYGeWkm5mpvXBJxWOjcJ1Q9KaZSz2o uX9bpGLpyh0jYXvAOSNsI1JKURQLOANIAYP5TZZf9XYZ9YcYgKo2YeHhlQdlBwSd4lle bxCwy7OrKmCmV50xfCzmmKjBG9o71FR9G693b4BsOAGvGDstqScT0W1ABjHGluTiVFwK M+XA== X-Gm-Message-State: AMke39ki4nYQmK7FsAxwmoMEXx8Lf9EYHhbffi+X7lAGkTYAP3OOh7ESyQ/3voej0koY3Q== X-Received: by 10.223.144.65 with SMTP id h59mr7840825wrh.30.1487342658556; Fri, 17 Feb 2017 06:44:18 -0800 (PST) Received: from fisk.suse.de (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id y126sm1932713wmg.19.2017.02.17.06.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:44:18 -0800 (PST) From: Nikolay Borisov X-Google-Original-From: Nikolay Borisov To: dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCH 32/38] btrfs: make btrfs_log_inode_parent take btrfs_inode Date: Fri, 17 Feb 2017 16:43:23 +0200 Message-Id: <1487342609-20652-33-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487342609-20652-1-git-send-email-nborisov@suse.com> References: <1487342609-20652-1-git-send-email-nborisov@suse.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/tree-log.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index cc616d424b7a..f36e4c49bc0e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -5395,7 +5395,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, * the last committed transaction */ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, - struct btrfs_root *root, struct inode *inode, + struct btrfs_root *root, struct btrfs_inode *inode, struct dentry *parent, const loff_t start, const loff_t end, @@ -5409,9 +5409,9 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, int ret = 0; u64 last_committed = fs_info->last_trans_committed; bool log_dentries = false; - struct inode *orig_inode = inode; + struct btrfs_inode *orig_inode = inode; - sb = inode->i_sb; + sb = inode->vfs_inode.i_sb; if (btrfs_test_opt(fs_info, NOTREELOG)) { ret = 1; @@ -5428,18 +5428,17 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, goto end_no_trans; } - if (root != BTRFS_I(inode)->root || - btrfs_root_refs(&root->root_item) == 0) { + if (root != inode->root || btrfs_root_refs(&root->root_item) == 0) { ret = 1; goto end_no_trans; } - ret = check_parent_dirs_for_sync(trans, BTRFS_I(inode), parent, - sb, last_committed); + ret = check_parent_dirs_for_sync(trans, inode, parent, sb, + last_committed); if (ret) goto end_no_trans; - if (btrfs_inode_in_log(BTRFS_I(inode), trans->transid)) { + if (btrfs_inode_in_log(inode, trans->transid)) { ret = BTRFS_NO_LOG_SYNC; goto end_no_trans; } @@ -5448,8 +5447,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, if (ret) goto end_no_trans; - ret = btrfs_log_inode(trans, root, BTRFS_I(inode), inode_only, - start, end, ctx); + ret = btrfs_log_inode(trans, root, inode, inode_only, start, end, ctx); if (ret) goto end_trans; @@ -5459,14 +5457,14 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, * we can use the last_unlink_trans field to record renames * and other fun in this file. */ - if (S_ISREG(inode->i_mode) && - BTRFS_I(inode)->generation <= last_committed && - BTRFS_I(inode)->last_unlink_trans <= last_committed) { + if (S_ISREG(inode->vfs_inode.i_mode) && + inode->generation <= last_committed && + inode->last_unlink_trans <= last_committed) { ret = 0; goto end_trans; } - if (S_ISDIR(inode->i_mode) && ctx && ctx->log_new_dentries) + if (S_ISDIR(inode->vfs_inode.i_mode) && ctx && ctx->log_new_dentries) log_dentries = true; /* @@ -5510,8 +5508,8 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, * but the file inode does not have a matching BTRFS_INODE_REF_KEY item * and has a link count of 2. */ - if (BTRFS_I(inode)->last_unlink_trans > last_committed) { - ret = btrfs_log_all_parents(trans, BTRFS_I(orig_inode), ctx); + if (inode->last_unlink_trans > last_committed) { + ret = btrfs_log_all_parents(trans, orig_inode, ctx); if (ret) goto end_trans; } @@ -5520,13 +5518,12 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) break; - inode = d_inode(parent); - if (root != BTRFS_I(inode)->root) + inode = BTRFS_I(d_inode(parent)); + if (root != inode->root) break; - if (BTRFS_I(inode)->generation > last_committed) { - ret = btrfs_log_inode(trans, root, BTRFS_I(inode), - LOG_INODE_EXISTS, + if (inode->generation > last_committed) { + ret = btrfs_log_inode(trans, root, inode, LOG_INODE_EXISTS, 0, LLONG_MAX, ctx); if (ret) goto end_trans; @@ -5539,7 +5536,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, old_parent = parent; } if (log_dentries) - ret = log_new_dir_dentries(trans, root, BTRFS_I(orig_inode), ctx); + ret = log_new_dir_dentries(trans, root, orig_inode, ctx); else ret = 0; end_trans: @@ -5571,7 +5568,7 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, struct dentry *parent = dget_parent(dentry); int ret; - ret = btrfs_log_inode_parent(trans, root, d_inode(dentry), parent, + ret = btrfs_log_inode_parent(trans, root, BTRFS_I(d_inode(dentry)), parent, start, end, 0, ctx); dput(parent); @@ -5834,7 +5831,7 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) return 0; - return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0, + return btrfs_log_inode_parent(trans, root, inode, parent, 0, LLONG_MAX, 1, NULL); }