Commit 877574e2 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Make btrfs_set_inode_index take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 4c570655
...@@ -6034,21 +6034,21 @@ static int btrfs_set_inode_index_count(struct btrfs_inode *inode) ...@@ -6034,21 +6034,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 * 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 * 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; int ret = 0;
if (BTRFS_I(dir)->index_cnt == (u64)-1) { if (dir->index_cnt == (u64)-1) {
ret = btrfs_inode_delayed_dir_index_count(BTRFS_I(dir)); ret = btrfs_inode_delayed_dir_index_count(dir);
if (ret) { if (ret) {
ret = btrfs_set_inode_index_count(BTRFS_I(dir)); ret = btrfs_set_inode_index_count(dir);
if (ret) if (ret)
return ret; return ret;
} }
} }
*index = BTRFS_I(dir)->index_cnt; *index = dir->index_cnt;
BTRFS_I(dir)->index_cnt++; dir->index_cnt++;
return ret; return ret;
} }
...@@ -6109,7 +6109,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, ...@@ -6109,7 +6109,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
if (dir && name) { if (dir && name) {
trace_btrfs_inode_request(dir); trace_btrfs_inode_request(dir);
ret = btrfs_set_inode_index(dir, index); ret = btrfs_set_inode_index(BTRFS_I(dir), index);
if (ret) { if (ret) {
btrfs_free_path(path); btrfs_free_path(path);
iput(inode); iput(inode);
...@@ -6490,7 +6490,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -6490,7 +6490,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
if (inode->i_nlink >= BTRFS_LINK_MAX) if (inode->i_nlink >= BTRFS_LINK_MAX)
return -EMLINK; return -EMLINK;
err = btrfs_set_inode_index(dir, &index); err = btrfs_set_inode_index(BTRFS_I(dir), &index);
if (err) if (err)
goto fail; goto fail;
...@@ -9480,10 +9480,10 @@ static int btrfs_rename_exchange(struct inode *old_dir, ...@@ -9480,10 +9480,10 @@ static int btrfs_rename_exchange(struct inode *old_dir,
* We need to find a free sequence number both in the source and * We need to find a free sequence number both in the source and
* in the destination directory for the exchange. * 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) if (ret)
goto out_fail; 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) if (ret)
goto out_fail; goto out_fail;
...@@ -9791,7 +9791,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -9791,7 +9791,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (dest != root) if (dest != root)
btrfs_record_root_in_trans(trans, dest); 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) if (ret)
goto out_fail; goto out_fail;
......
...@@ -580,7 +580,7 @@ static noinline int create_subvol(struct inode *dir, ...@@ -580,7 +580,7 @@ static noinline int create_subvol(struct inode *dir,
/* /*
* insert the directory item * insert the directory item
*/ */
ret = btrfs_set_inode_index(dir, &index); ret = btrfs_set_inode_index(BTRFS_I(dir), &index);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto fail; goto fail;
......
...@@ -1505,7 +1505,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, ...@@ -1505,7 +1505,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
/* /*
* insert the directory item * 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 */ BUG_ON(ret); /* -ENOMEM */
/* check if there is a file/dir which has the same name. */ /* check if there is a file/dir which has the same name. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment