From patchwork Fri Feb 17 14:42:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579963 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 DA67F600F6 for ; Fri, 17 Feb 2017 14:44:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC1F286F4 for ; Fri, 17 Feb 2017 14:44:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF7CD286F6; Fri, 17 Feb 2017 14:44:00 +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 5F137286F4 for ; Fri, 17 Feb 2017 14:44:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934368AbdBQOnz (ORCPT ); Fri, 17 Feb 2017 09:43:55 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33994 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933963AbdBQOnx (ORCPT ); Fri, 17 Feb 2017 09:43:53 -0500 Received: by mail-wm0-f68.google.com with SMTP id c85so2930243wmi.1 for ; Fri, 17 Feb 2017 06:43:52 -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=LIs5xxruMyhh+Aawq+iaJ+P19cPpqxcrpw5tVkb3b+I=; b=jzG/ro1fZzf5z6xVEYS6VXeWlg1fT49EwGoZJ+hKLJ6PRi2n3wF+rg1rGpxU4pWmx3 VlUy5iUNwepG3e794DRO2fsWDSDF5WoBRxPnnFRIeU6hZLejQal3B2Ax1yZjRxI3B3IY 9GN9Kzw1FGy+vLWfMVie39WjBqfy81mxuU9JY7gjy8eCb+S40xyH32VnTCjtvmVpWOnj OsIKQaWvGaQYBPNMzNHuRhsXcfP7HBsQ+fmKVsm9NW3cFBqqid42n/19sHhtvfDKCuGN sxyyxn/bpOdeaJO/gqvyAvsw9eh1nIW0ZEdGVyIQw8HH1sfdrIHHYTamplfmjK0WHNo+ TG9g== 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=LIs5xxruMyhh+Aawq+iaJ+P19cPpqxcrpw5tVkb3b+I=; b=Bl68dn12Uqa1xkcA83BCAmVg768ryfnFlX0SE4WQSo1Hc8Dq96paiiaIQVXOMRagKP Tb3k9OOeQbMwTOUT36VjbkbCOyN8tUcR/pQXtjgluLsj1t+s+npwuMbpTuv5ZbGW/FZX 2HfCgZtIoeGYjLrvzOHalF7NqMCQkmKxXjdhyy6r9hc8HbAGbX3BeBPgoVLj1E4+g1js tVB+DNAySAq3iY1pF423BXbRhx18elc5Qv9svRlZJBMR/DtvUlLjH+fbt6C4PiNcWK2l njw+EU+Pij++JRn5GCjcdPWzoW3ZOJzeP8+k0p6395udKvT9t6sbo/iZE0d2aPW5ElMe 6SPg== X-Gm-Message-State: AMke39lee5Kb+D6qYAT9nod9Z/qtySPBRvZQN9eczrPanFFgk44SqYe+/e+6ugQgA2/Kfg== X-Received: by 10.28.144.135 with SMTP id s129mr2286250wmd.18.1487342631712; Fri, 17 Feb 2017 06:43:51 -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.43.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:43:50 -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 04/38] btrfs: Make btrfs_set_inode_index take btrfs_inode Date: Fri, 17 Feb 2017 16:42:55 +0200 Message-Id: <1487342609-20652-5-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/inode.c | 22 +++++++++++----------- fs/btrfs/ioctl.c | 2 +- fs/btrfs/transaction.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c8796391eed3..a4ccfffa4082 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6033,21 +6033,21 @@ static int btrfs_set_inode_index_count(struct btrfs_inode *inode) * helper to find a free sequence number in a given directory. This current * code is very simple, later versions will do smarter things in the btree */ -int btrfs_set_inode_index(struct inode *dir, u64 *index) +int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index) { int ret = 0; - if (BTRFS_I(dir)->index_cnt == (u64)-1) { - ret = btrfs_inode_delayed_dir_index_count(BTRFS_I(dir)); + if (dir->index_cnt == (u64)-1) { + ret = btrfs_inode_delayed_dir_index_count(dir); if (ret) { - ret = btrfs_set_inode_index_count(BTRFS_I(dir)); + ret = btrfs_set_inode_index_count(dir); if (ret) return ret; } } - *index = BTRFS_I(dir)->index_cnt; - BTRFS_I(dir)->index_cnt++; + *index = dir->index_cnt; + dir->index_cnt++; return ret; } @@ -6108,7 +6108,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, if (dir && name) { trace_btrfs_inode_request(dir); - ret = btrfs_set_inode_index(dir, index); + ret = btrfs_set_inode_index(BTRFS_I(dir), index); if (ret) { btrfs_free_path(path); iput(inode); @@ -6489,7 +6489,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, if (inode->i_nlink >= BTRFS_LINK_MAX) return -EMLINK; - err = btrfs_set_inode_index(dir, &index); + err = btrfs_set_inode_index(BTRFS_I(dir), &index); if (err) goto fail; @@ -9479,10 +9479,10 @@ static int btrfs_rename_exchange(struct inode *old_dir, * We need to find a free sequence number both in the source and * in the destination directory for the exchange. */ - ret = btrfs_set_inode_index(new_dir, &old_idx); + ret = btrfs_set_inode_index(BTRFS_I(new_dir), &old_idx); if (ret) goto out_fail; - ret = btrfs_set_inode_index(old_dir, &new_idx); + ret = btrfs_set_inode_index(BTRFS_I(old_dir), &new_idx); if (ret) goto out_fail; @@ -9790,7 +9790,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, if (dest != root) btrfs_record_root_in_trans(trans, dest); - ret = btrfs_set_inode_index(new_dir, &index); + ret = btrfs_set_inode_index(BTRFS_I(new_dir), &index); if (ret) goto out_fail; diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 952762582b3d..be206285ba81 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -580,7 +580,7 @@ static noinline int create_subvol(struct inode *dir, /* * insert the directory item */ - ret = btrfs_set_inode_index(dir, &index); + ret = btrfs_set_inode_index(BTRFS_I(dir), &index); if (ret) { btrfs_abort_transaction(trans, ret); goto fail; diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 294563216dd3..05c2bbff2a28 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1505,7 +1505,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, /* * insert the directory item */ - ret = btrfs_set_inode_index(parent_inode, &index); + ret = btrfs_set_inode_index(BTRFS_I(parent_inode), &index); BUG_ON(ret); /* -ENOMEM */ /* check if there is a file/dir which has the same name. */