From patchwork Tue Jan 17 22:31:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9522059 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 CDA376020B for ; Tue, 17 Jan 2017 22:41:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C187A28592 for ; Tue, 17 Jan 2017 22:41:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5AAC285F0; Tue, 17 Jan 2017 22:41:48 +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 606DB28592 for ; Tue, 17 Jan 2017 22:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbdAQWlp (ORCPT ); Tue, 17 Jan 2017 17:41:45 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34655 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751228AbdAQWlh (ORCPT ); Tue, 17 Jan 2017 17:41:37 -0500 Received: by mail-wm0-f67.google.com with SMTP id c85so9434750wmi.1 for ; Tue, 17 Jan 2017 14:41:36 -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=J9l1OSwagogXqAIlzXv5OVgGp3KLqilWjFJlkVLVm0k=; b=bBuAt+O8OAJNrFntXKt+n0TIfnXHgaAcGJt4JAhDdD1a1jf5fuLt8EnCo1D6Lfsmey rVq/Kz24M7O5gg4KwBGOh/g8xyQIuubcIIhcTauLYtYO+JyDLlrnWbH3caX+Jb32Gsfa wOJT6LqEegTqxFg2iVz7PAN/7GjbQxycdblflzAFiGHGF95GAhPD9ySTtnjJ7UvVSPIL 86HXE6RM9Y2Io+zd+OF7yUJsq4kZzkfbyLEk27vxgDKhsfJt5X+dtjuEj7018Lk7j+LQ M1Ls3kIRsIhSIOUehjGRTcGXPGE3f0z5DHAL/Ic1xnIqIkQJJM3Ay68/lLtB53TxGnAX t1Hg== 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=J9l1OSwagogXqAIlzXv5OVgGp3KLqilWjFJlkVLVm0k=; b=MKTnlD0+CtSe6TjxGHazkOwvhVtcYjYRgc2gst0iNhEZIrVuoqbyMyWxHgBWN62AHL CQ9T0VdPbVfGo9gvvbJPFYNrOWWZcXPPt/kZyoh7TrWRixNn1vsHzBEq55YDbJogQWcT zocj/ktkuW1rgzPz/ytVzWVfFHb9m4xq3NmVRZPndLwQbj0vbpMbp3REqPcmIh+V8/Q4 uVx3P/zs6crDsL+ZJXrO+wdELt+AVicXjSgbEhPMQ7zEpy1uqvfSN/d7V/tcQrKA8u+p 4pTZTGE9KGRD3Arn0o82aCJSPkBSqRHtdm7SD4/wT4PC/w8pcVH93lNTEhjYsxTNSJU4 dboA== X-Gm-Message-State: AIkVDXJlOka4E7SqShGP2Dgmgx/kHuDh6+HaXN+3qeJ9HhL+z6XvVMHlbLy/iLxa/B/GxQ== X-Received: by 10.28.156.151 with SMTP id f145mr387918wme.8.1484692351117; Tue, 17 Jan 2017 14:32:31 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 14:32:30 -0800 (PST) From: Nikolay Borisov To: dsterba@suse.cz Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCHv2 20/24] btrfs: Make __add_inode_ref take btrfs_inode Date: Wed, 18 Jan 2017 00:31:46 +0200 Message-Id: <1484692310-3987-21-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/tree-log.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 35434d686653..d919cd4252ba 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -991,7 +991,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct btrfs_root *log_root, - struct inode *dir, struct inode *inode, + struct btrfs_inode *dir, struct btrfs_inode *inode, struct extent_buffer *eb, u64 inode_objectid, u64 parent_objectid, u64 ref_index, char *name, int namelen, @@ -1047,12 +1047,11 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, parent_objectid, victim_name, victim_name_len)) { - inc_nlink(inode); + inc_nlink(&inode->vfs_inode); btrfs_release_path(path); - ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), - BTRFS_I(inode), victim_name, - victim_name_len); + ret = btrfs_unlink_inode(trans, root, dir, inode, + victim_name, victim_name_len); kfree(victim_name); if (ret) return ret; @@ -1114,15 +1113,14 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, parent_objectid, victim_name, victim_name_len)) { ret = -ENOENT; - victim_parent = read_one_inode(root, - parent_objectid); + victim_parent = read_one_inode(root, parent_objectid); if (victim_parent) { - inc_nlink(inode); + inc_nlink(&inode->vfs_inode); btrfs_release_path(path); ret = btrfs_unlink_inode(trans, root, BTRFS_I(victim_parent), - BTRFS_I(inode), + inode, victim_name, victim_name_len); if (!ret) @@ -1148,20 +1146,20 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, btrfs_release_path(path); /* look for a conflicting sequence number */ - di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)), + di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), ref_index, name, namelen, 0); if (di && !IS_ERR(di)) { - ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di); + ret = drop_one_dir_item(trans, root, path, dir, di); if (ret) return ret; } btrfs_release_path(path); /* look for a conflicing name */ - di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)), + di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), name, namelen, 0); if (di && !IS_ERR(di)) { - ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di); + ret = drop_one_dir_item(trans, root, path, dir, di); if (ret) return ret; } @@ -1307,7 +1305,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, if (!search_done) { ret = __add_inode_ref(trans, root, path, log, - dir, inode, eb, + BTRFS_I(dir), BTRFS_I(inode), eb, inode_objectid, parent_objectid, ref_index, name, namelen,