Commit 8b9d0322 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: remove redundant root argument from btrfs_update_inode()

The root argument for btrfs_update_inode() always matches the root of the
given inode, so remove the root argument and get it from the inode
argument.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0a5d0dc5
...@@ -3051,7 +3051,6 @@ static int cache_save_setup(struct btrfs_block_group *block_group, ...@@ -3051,7 +3051,6 @@ static int cache_save_setup(struct btrfs_block_group *block_group,
struct btrfs_path *path) struct btrfs_path *path)
{ {
struct btrfs_fs_info *fs_info = block_group->fs_info; struct btrfs_fs_info *fs_info = block_group->fs_info;
struct btrfs_root *root = fs_info->tree_root;
struct inode *inode = NULL; struct inode *inode = NULL;
struct extent_changeset *data_reserved = NULL; struct extent_changeset *data_reserved = NULL;
u64 alloc_hint = 0; u64 alloc_hint = 0;
...@@ -3103,7 +3102,7 @@ static int cache_save_setup(struct btrfs_block_group *block_group, ...@@ -3103,7 +3102,7 @@ static int cache_save_setup(struct btrfs_block_group *block_group,
* time. * time.
*/ */
BTRFS_I(inode)->generation = 0; BTRFS_I(inode)->generation = 0;
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) { if (ret) {
/* /*
* So theoretically we could recover from this, simply set the * So theoretically we could recover from this, simply set the
......
...@@ -482,7 +482,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -482,7 +482,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset, struct page *page, size_t pg_offset,
u64 start, u64 end); u64 start, u64 end);
int btrfs_update_inode(struct btrfs_trans_handle *trans, int btrfs_update_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_inode *inode); struct btrfs_inode *inode);
int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
struct btrfs_inode *inode); struct btrfs_inode *inode);
int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct btrfs_inode *inode); int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct btrfs_inode *inode);
......
...@@ -2479,7 +2479,7 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, ...@@ -2479,7 +2479,7 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode,
if (!extent_info || extent_info->update_times) if (!extent_info || extent_info->update_times)
inode->vfs_inode.i_mtime = inode_set_ctime_current(&inode->vfs_inode); inode->vfs_inode.i_mtime = inode_set_ctime_current(&inode->vfs_inode);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
if (ret) if (ret)
break; break;
...@@ -2719,7 +2719,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len) ...@@ -2719,7 +2719,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len)
ASSERT(trans != NULL); ASSERT(trans != NULL);
inode_inc_iversion(inode); inode_inc_iversion(inode);
inode->i_mtime = inode_set_ctime_current(inode); inode->i_mtime = inode_set_ctime_current(inode);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
updated_inode = true; updated_inode = true;
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info); btrfs_btree_balance_dirty(fs_info);
...@@ -2745,7 +2745,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len) ...@@ -2745,7 +2745,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len)
} else { } else {
int ret2; int ret2;
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
ret2 = btrfs_end_transaction(trans); ret2 = btrfs_end_transaction(trans);
if (!ret) if (!ret)
ret = ret2; ret = ret2;
...@@ -2812,7 +2812,7 @@ static int btrfs_fallocate_update_isize(struct inode *inode, ...@@ -2812,7 +2812,7 @@ static int btrfs_fallocate_update_isize(struct inode *inode,
inode_set_ctime_current(inode); inode_set_ctime_current(inode);
i_size_write(inode, end); i_size_write(inode, end);
btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0); btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
ret2 = btrfs_end_transaction(trans); ret2 = btrfs_end_transaction(trans);
return ret ? ret : ret2; return ret ? ret : ret2;
......
...@@ -359,7 +359,7 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans, ...@@ -359,7 +359,7 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans,
if (ret) if (ret)
goto fail; goto fail;
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
fail: fail:
if (locked) if (locked)
...@@ -1326,7 +1326,7 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root, ...@@ -1326,7 +1326,7 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root,
"failed to write free space cache for block group %llu error %d", "failed to write free space cache for block group %llu error %d",
block_group->start, ret); block_group->start, ret);
} }
btrfs_update_inode(trans, root, BTRFS_I(inode)); btrfs_update_inode(trans, BTRFS_I(inode));
if (block_group) { if (block_group) {
/* the dirty list is protected by the dirty_bgs_lock */ /* the dirty list is protected by the dirty_bgs_lock */
...@@ -1367,7 +1367,6 @@ int btrfs_wait_cache_io(struct btrfs_trans_handle *trans, ...@@ -1367,7 +1367,6 @@ int btrfs_wait_cache_io(struct btrfs_trans_handle *trans,
/* /*
* Write out cached info to an inode. * Write out cached info to an inode.
* *
* @root: root the inode belongs to
* @inode: freespace inode we are writing out * @inode: freespace inode we are writing out
* @ctl: free space cache we are going to write out * @ctl: free space cache we are going to write out
* @block_group: block_group for this cache if it belongs to a block_group * @block_group: block_group for this cache if it belongs to a block_group
...@@ -1378,7 +1377,7 @@ int btrfs_wait_cache_io(struct btrfs_trans_handle *trans, ...@@ -1378,7 +1377,7 @@ int btrfs_wait_cache_io(struct btrfs_trans_handle *trans,
* on mount. This will return 0 if it was successful in writing the cache out, * on mount. This will return 0 if it was successful in writing the cache out,
* or an errno if it was not. * or an errno if it was not.
*/ */
static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, static int __btrfs_write_out_cache(struct inode *inode,
struct btrfs_free_space_ctl *ctl, struct btrfs_free_space_ctl *ctl,
struct btrfs_block_group *block_group, struct btrfs_block_group *block_group,
struct btrfs_io_ctl *io_ctl, struct btrfs_io_ctl *io_ctl,
...@@ -1511,7 +1510,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, ...@@ -1511,7 +1510,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
invalidate_inode_pages2(inode->i_mapping); invalidate_inode_pages2(inode->i_mapping);
BTRFS_I(inode)->generation = 0; BTRFS_I(inode)->generation = 0;
} }
btrfs_update_inode(trans, root, BTRFS_I(inode)); btrfs_update_inode(trans, BTRFS_I(inode));
if (must_iput) if (must_iput)
iput(inode); iput(inode);
return ret; return ret;
...@@ -1537,8 +1536,8 @@ int btrfs_write_out_cache(struct btrfs_trans_handle *trans, ...@@ -1537,8 +1536,8 @@ int btrfs_write_out_cache(struct btrfs_trans_handle *trans,
if (IS_ERR(inode)) if (IS_ERR(inode))
return 0; return 0;
ret = __btrfs_write_out_cache(fs_info->tree_root, inode, ctl, ret = __btrfs_write_out_cache(inode, ctl, block_group,
block_group, &block_group->io_ctl, trans); &block_group->io_ctl, trans);
if (ret) { if (ret) {
btrfs_debug(fs_info, btrfs_debug(fs_info,
"failed to write free space cache for block group %llu error %d", "failed to write free space cache for block group %llu error %d",
......
...@@ -671,7 +671,7 @@ static noinline int cow_file_range_inline(struct btrfs_inode *inode, u64 size, ...@@ -671,7 +671,7 @@ static noinline int cow_file_range_inline(struct btrfs_inode *inode, u64 size,
} }
btrfs_update_inode_bytes(inode, size, drop_args.bytes_found); btrfs_update_inode_bytes(inode, size, drop_args.bytes_found);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
if (ret && ret != -ENOSPC) { if (ret && ret != -ENOSPC) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto out; goto out;
...@@ -4002,9 +4002,9 @@ static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans, ...@@ -4002,9 +4002,9 @@ static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans,
* copy everything in the in-memory inode into the btree. * copy everything in the in-memory inode into the btree.
*/ */
int btrfs_update_inode(struct btrfs_trans_handle *trans, int btrfs_update_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_inode *inode) struct btrfs_inode *inode)
{ {
struct btrfs_root *root = inode->root;
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
int ret; int ret;
...@@ -4034,7 +4034,7 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, ...@@ -4034,7 +4034,7 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
{ {
int ret; int ret;
ret = btrfs_update_inode(trans, inode->root, inode); ret = btrfs_update_inode(trans, inode);
if (ret == -ENOSPC) if (ret == -ENOSPC)
return btrfs_update_inode_item(trans, inode->root, inode); return btrfs_update_inode_item(trans, inode->root, inode);
return ret; return ret;
...@@ -4143,7 +4143,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans, ...@@ -4143,7 +4143,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
inode_inc_iversion(&dir->vfs_inode); inode_inc_iversion(&dir->vfs_inode);
inode_set_ctime_current(&inode->vfs_inode); inode_set_ctime_current(&inode->vfs_inode);
dir->vfs_inode.i_mtime = inode_set_ctime_current(&dir->vfs_inode); dir->vfs_inode.i_mtime = inode_set_ctime_current(&dir->vfs_inode);
ret = btrfs_update_inode(trans, root, dir); ret = btrfs_update_inode(trans, dir);
out: out:
return ret; return ret;
} }
...@@ -4157,7 +4157,7 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans, ...@@ -4157,7 +4157,7 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
ret = __btrfs_unlink_inode(trans, dir, inode, name, NULL); ret = __btrfs_unlink_inode(trans, dir, inode, name, NULL);
if (!ret) { if (!ret) {
drop_nlink(&inode->vfs_inode); drop_nlink(&inode->vfs_inode);
ret = btrfs_update_inode(trans, inode->root, inode); ret = btrfs_update_inode(trans, inode);
} }
return ret; return ret;
} }
...@@ -4843,7 +4843,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode, ...@@ -4843,7 +4843,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode,
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
} else { } else {
btrfs_update_inode_bytes(inode, 0, drop_args.bytes_found); btrfs_update_inode_bytes(inode, 0, drop_args.bytes_found);
btrfs_update_inode(trans, root, inode); btrfs_update_inode(trans, inode);
} }
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
return ret; return ret;
...@@ -4994,7 +4994,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) ...@@ -4994,7 +4994,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
i_size_write(inode, newsize); i_size_write(inode, newsize);
btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0); btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0);
pagecache_isize_extended(inode, oldsize, newsize); pagecache_isize_extended(inode, oldsize, newsize);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
btrfs_drew_write_unlock(&root->snapshot_lock); btrfs_drew_write_unlock(&root->snapshot_lock);
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
} else { } else {
...@@ -6010,7 +6010,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode) ...@@ -6010,7 +6010,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode)
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
if (ret == -ENOSPC || ret == -EDQUOT) { if (ret == -ENOSPC || ret == -EDQUOT) {
/* whoops, lets try again with the full transaction */ /* whoops, lets try again with the full transaction */
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
...@@ -6018,7 +6018,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode) ...@@ -6018,7 +6018,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode)
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
} }
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
if (inode->delayed_node) if (inode->delayed_node)
...@@ -6457,7 +6457,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, ...@@ -6457,7 +6457,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
parent_inode->vfs_inode.i_mtime = parent_inode->vfs_inode.i_mtime =
inode_set_ctime_current(&parent_inode->vfs_inode); inode_set_ctime_current(&parent_inode->vfs_inode);
ret = btrfs_update_inode(trans, root, parent_inode); ret = btrfs_update_inode(trans, parent_inode);
if (ret) if (ret)
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
return ret; return ret;
...@@ -6608,7 +6608,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -6608,7 +6608,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
} else { } else {
struct dentry *parent = dentry->d_parent; struct dentry *parent = dentry->d_parent;
err = btrfs_update_inode(trans, root, BTRFS_I(inode)); err = btrfs_update_inode(trans, BTRFS_I(inode));
if (err) if (err)
goto fail; goto fail;
if (inode->i_nlink == 1) { if (inode->i_nlink == 1) {
...@@ -8349,7 +8349,7 @@ static int btrfs_truncate(struct btrfs_inode *inode, bool skip_writeback) ...@@ -8349,7 +8349,7 @@ static int btrfs_truncate(struct btrfs_inode *inode, bool skip_writeback)
if (ret != -ENOSPC && ret != -EAGAIN) if (ret != -ENOSPC && ret != -EAGAIN)
break; break;
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
if (ret) if (ret)
break; break;
...@@ -8402,7 +8402,7 @@ static int btrfs_truncate(struct btrfs_inode *inode, bool skip_writeback) ...@@ -8402,7 +8402,7 @@ static int btrfs_truncate(struct btrfs_inode *inode, bool skip_writeback)
int ret2; int ret2;
trans->block_rsv = &fs_info->trans_block_rsv; trans->block_rsv = &fs_info->trans_block_rsv;
ret2 = btrfs_update_inode(trans, root, inode); ret2 = btrfs_update_inode(trans, inode);
if (ret2 && !ret) if (ret2 && !ret)
ret = ret2; ret = ret2;
...@@ -8833,7 +8833,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, ...@@ -8833,7 +8833,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
BTRFS_I(old_dentry->d_inode), BTRFS_I(old_dentry->d_inode),
old_name, &old_rename_ctx); old_name, &old_rename_ctx);
if (!ret) if (!ret)
ret = btrfs_update_inode(trans, root, BTRFS_I(old_inode)); ret = btrfs_update_inode(trans, BTRFS_I(old_inode));
} }
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
...@@ -8848,7 +8848,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, ...@@ -8848,7 +8848,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
BTRFS_I(new_dentry->d_inode), BTRFS_I(new_dentry->d_inode),
new_name, &new_rename_ctx); new_name, &new_rename_ctx);
if (!ret) if (!ret)
ret = btrfs_update_inode(trans, dest, BTRFS_I(new_inode)); ret = btrfs_update_inode(trans, BTRFS_I(new_inode));
} }
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
...@@ -9093,7 +9093,7 @@ static int btrfs_rename(struct mnt_idmap *idmap, ...@@ -9093,7 +9093,7 @@ static int btrfs_rename(struct mnt_idmap *idmap,
BTRFS_I(d_inode(old_dentry)), BTRFS_I(d_inode(old_dentry)),
&old_fname.disk_name, &rename_ctx); &old_fname.disk_name, &rename_ctx);
if (!ret) if (!ret)
ret = btrfs_update_inode(trans, root, BTRFS_I(old_inode)); ret = btrfs_update_inode(trans, BTRFS_I(old_inode));
} }
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
...@@ -9649,7 +9649,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode, ...@@ -9649,7 +9649,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0); btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0);
} }
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
......
...@@ -385,7 +385,7 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap, ...@@ -385,7 +385,7 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
btrfs_sync_inode_flags_to_i_flags(inode); btrfs_sync_inode_flags_to_i_flags(inode);
inode_inc_iversion(inode); inode_inc_iversion(inode);
inode_set_ctime_current(inode); inode_set_ctime_current(inode);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
out_end_trans: out_end_trans:
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
......
...@@ -25,7 +25,6 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans, ...@@ -25,7 +25,6 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
const u64 olen, const u64 olen,
int no_time_update) int no_time_update)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret; int ret;
inode_inc_iversion(inode); inode_inc_iversion(inode);
...@@ -43,7 +42,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans, ...@@ -43,7 +42,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0); btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0);
} }
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
......
...@@ -890,7 +890,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, ...@@ -890,7 +890,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
update_inode: update_inode:
btrfs_update_inode_bytes(BTRFS_I(inode), nbytes, drop_args.bytes_found); btrfs_update_inode_bytes(BTRFS_I(inode), nbytes, drop_args.bytes_found);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
out: out:
iput(inode); iput(inode);
return ret; return ret;
...@@ -1445,7 +1445,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, ...@@ -1445,7 +1445,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
if (ret) if (ret)
goto out; goto out;
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) if (ret)
goto out; goto out;
} }
...@@ -1623,7 +1623,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, ...@@ -1623,7 +1623,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
if (nlink != inode->i_nlink) { if (nlink != inode->i_nlink) {
set_nlink(inode, nlink); set_nlink(inode, nlink);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) if (ret)
goto out; goto out;
} }
...@@ -1732,7 +1732,7 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans, ...@@ -1732,7 +1732,7 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
set_nlink(inode, 1); set_nlink(inode, 1);
else else
inc_nlink(inode); inc_nlink(inode);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
} else if (ret == -EEXIST) { } else if (ret == -EEXIST) {
ret = 0; ret = 0;
} }
...@@ -1939,7 +1939,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, ...@@ -1939,7 +1939,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
out: out:
if (!ret && update_size) { if (!ret && update_size) {
btrfs_i_size_write(BTRFS_I(dir), dir->i_size + name.len * 2); btrfs_i_size_write(BTRFS_I(dir), dir->i_size + name.len * 2);
ret = btrfs_update_inode(trans, root, BTRFS_I(dir)); ret = btrfs_update_inode(trans, BTRFS_I(dir));
} }
kfree(name.name); kfree(name.name);
iput(dir); iput(dir);
...@@ -2483,7 +2483,7 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb, ...@@ -2483,7 +2483,7 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
drop_args.bytes_found); drop_args.bytes_found);
/* Update the inode's nbytes. */ /* Update the inode's nbytes. */
ret = btrfs_update_inode(wc->trans, ret = btrfs_update_inode(wc->trans,
root, BTRFS_I(inode)); BTRFS_I(inode));
} }
iput(inode); iput(inode);
if (ret) if (ret)
......
...@@ -487,7 +487,7 @@ static int rollback_verity(struct btrfs_inode *inode) ...@@ -487,7 +487,7 @@ static int rollback_verity(struct btrfs_inode *inode)
} }
inode->ro_flags &= ~BTRFS_INODE_RO_VERITY; inode->ro_flags &= ~BTRFS_INODE_RO_VERITY;
btrfs_sync_inode_flags_to_i_flags(&inode->vfs_inode); btrfs_sync_inode_flags_to_i_flags(&inode->vfs_inode);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto out; goto out;
...@@ -554,7 +554,7 @@ static int finish_verity(struct btrfs_inode *inode, const void *desc, ...@@ -554,7 +554,7 @@ static int finish_verity(struct btrfs_inode *inode, const void *desc,
} }
inode->ro_flags |= BTRFS_INODE_RO_VERITY; inode->ro_flags |= BTRFS_INODE_RO_VERITY;
btrfs_sync_inode_flags_to_i_flags(&inode->vfs_inode); btrfs_sync_inode_flags_to_i_flags(&inode->vfs_inode);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, inode);
if (ret) if (ret)
goto end_trans; goto end_trans;
ret = del_orphan(trans, inode); ret = del_orphan(trans, inode);
......
...@@ -265,7 +265,7 @@ int btrfs_setxattr_trans(struct inode *inode, const char *name, ...@@ -265,7 +265,7 @@ int btrfs_setxattr_trans(struct inode *inode, const char *name,
inode_inc_iversion(inode); inode_inc_iversion(inode);
inode_set_ctime_current(inode); inode_set_ctime_current(inode);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) if (ret)
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
out: out:
...@@ -408,7 +408,7 @@ static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler, ...@@ -408,7 +408,7 @@ static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
if (!ret) { if (!ret) {
inode_inc_iversion(inode); inode_inc_iversion(inode);
inode_set_ctime_current(inode); inode_set_ctime_current(inode);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); ret = btrfs_update_inode(trans, BTRFS_I(inode));
if (ret) if (ret)
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
} }
......
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