btrfs: remove root parameter from transaction commit/end routines
Now we only use the root parameter to print the root objectid in
a tracepoint. We can use the root parameter from the transaction
handle for that. It's also used to join the transaction with
async commits, so we remove the comment that it's just for checking.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5fa8aeb..dbcec1c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -326,7 +326,7 @@ static noinline int cow_file_range_inline(struct btrfs_root *root,
*/
btrfs_qgroup_free_data(inode, 0, PAGE_SIZE);
btrfs_free_path(path);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
return ret;
}
@@ -1534,7 +1534,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
}
error:
- err = btrfs_end_transaction(trans, root);
+ err = btrfs_end_transaction(trans);
if (!ret)
ret = err;
@@ -2665,7 +2665,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
out_free_path:
btrfs_release_path(path);
path->leave_spinning = 0;
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
out_unlock:
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end,
&cached, GFP_NOFS);
@@ -3011,7 +3011,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
if (root != fs_info->tree_root)
btrfs_delalloc_release_metadata(inode, ordered_extent->len);
if (trans)
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (ret || truncated) {
u64 start, end;
@@ -3519,7 +3519,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
found_key.objectid);
ret = btrfs_del_orphan_item(trans, root,
found_key.objectid);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (ret)
goto out;
continue;
@@ -3549,7 +3549,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
goto out;
}
ret = btrfs_orphan_add(trans, inode);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (ret) {
iput(inode);
goto out;
@@ -3580,7 +3580,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)) {
trans = btrfs_join_transaction(root);
if (!IS_ERR(trans))
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
}
if (nr_unlink)
@@ -4156,7 +4156,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
}
out:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(root->fs_info);
return ret;
}
@@ -4293,7 +4293,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
BTRFS_I(dir)->last_unlink_trans = last_unlink_trans;
}
out:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(root->fs_info);
return err;
@@ -4453,7 +4453,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
* bytes_deleted is > 0, it will be huge by the time we get here
*/
if (be_nice && bytes_deleted > SZ_32M) {
- if (btrfs_should_end_transaction(trans, root)) {
+ if (btrfs_should_end_transaction(trans)) {
err = -EAGAIN;
goto error;
}
@@ -4858,7 +4858,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
ret = btrfs_drop_extents(trans, root, inode, offset, offset + len, 1);
if (ret) {
btrfs_abort_transaction(trans, ret);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
return ret;
}
@@ -4868,7 +4868,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
btrfs_abort_transaction(trans, ret);
else
btrfs_update_inode(trans, root, inode);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
return ret;
}
@@ -5032,7 +5032,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
pagecache_isize_extended(inode, oldsize, newsize);
ret = btrfs_update_inode(trans, root, inode);
btrfs_end_write_no_snapshoting(root);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
} else {
/*
@@ -5063,7 +5063,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
* will be consistent.
*/
ret = btrfs_orphan_add(trans, inode);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (ret)
return ret;
@@ -5094,7 +5094,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
err = btrfs_orphan_del(trans, inode);
if (err)
btrfs_abort_transaction(trans, err);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
}
}
@@ -5355,7 +5355,7 @@ void btrfs_evict_inode(struct inode *inode)
* again.
*/
if (ret) {
- ret = btrfs_commit_transaction(trans, root);
+ ret = btrfs_commit_transaction(trans);
if (ret) {
btrfs_orphan_del(NULL, inode);
btrfs_free_block_rsv(fs_info, rsv);
@@ -5373,7 +5373,7 @@ void btrfs_evict_inode(struct inode *inode)
break;
trans->block_rsv = &fs_info->trans_block_rsv;
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
trans = NULL;
btrfs_btree_balance_dirty(fs_info);
}
@@ -5396,7 +5396,7 @@ void btrfs_evict_inode(struct inode *inode)
root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID))
btrfs_return_ino(root, btrfs_ino(inode));
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
no_delete:
btrfs_remove_delayed_node(inode);
@@ -5975,7 +5975,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
trans = btrfs_join_transaction(root);
if (IS_ERR(trans))
return PTR_ERR(trans);
- ret = btrfs_commit_transaction(trans, root);
+ ret = btrfs_commit_transaction(trans);
}
return ret;
}
@@ -6003,14 +6003,14 @@ static int btrfs_dirty_inode(struct inode *inode)
ret = btrfs_update_inode(trans, root, inode);
if (ret && ret == -ENOSPC) {
/* whoops, lets try again with the full transaction */
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
trans = btrfs_start_transaction(root, 1);
if (IS_ERR(trans))
return PTR_ERR(trans);
ret = btrfs_update_inode(trans, root, inode);
}
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (BTRFS_I(inode)->delayed_node)
btrfs_balance_delayed_items(fs_info);
@@ -6448,7 +6448,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
}
out_unlock:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
btrfs_balance_delayed_items(fs_info);
btrfs_btree_balance_dirty(fs_info);
if (drop_inode) {
@@ -6524,7 +6524,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
d_instantiate(dentry, inode);
out_unlock:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (err && drop_inode_on_err) {
inode_dec_link_count(inode);
iput(inode);
@@ -6606,7 +6606,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
btrfs_balance_delayed_items(fs_info);
fail:
if (trans)
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (drop_inode) {
inode_dec_link_count(inode);
iput(inode);
@@ -6675,7 +6675,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
drop_on_err = 0;
out_fail:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (drop_on_err) {
inode_dec_link_count(inode);
iput(inode);
@@ -7063,7 +7063,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
btrfs_free_path(path);
if (trans) {
- ret = btrfs_end_transaction(trans, root);
+ ret = btrfs_end_transaction(trans);
if (!err)
err = ret;
}
@@ -7386,7 +7386,7 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
ret = btrfs_cross_ref_exist(trans, root, btrfs_ino(inode),
key.offset - backref_offset, disk_bytenr);
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (ret) {
ret = 0;
goto out;
@@ -9200,7 +9200,7 @@ static int btrfs_truncate(struct inode *inode)
break;
}
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
trans = btrfs_start_transaction(root, 2);
@@ -9229,7 +9229,7 @@ static int btrfs_truncate(struct inode *inode)
if (ret && !err)
err = ret;
- ret = btrfs_end_transaction(trans, root);
+ ret = btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
}
out:
@@ -9697,7 +9697,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
dest_log_pinned = false;
}
}
- ret = btrfs_end_transaction(trans, root);
+ ret = btrfs_end_transaction(trans);
out_notrans:
if (new_ino == BTRFS_FIRST_FREE_OBJECTID)
up_read(&fs_info->subvol_sem);
@@ -9967,7 +9967,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
btrfs_end_log_trans(root);
log_pinned = false;
}
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
out_notrans:
if (old_ino == BTRFS_FIRST_FREE_OBJECTID)
up_read(&fs_info->subvol_sem);
@@ -10300,7 +10300,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
d_instantiate(dentry, inode);
out_unlock:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (drop_inode) {
inode_dec_link_count(inode);
iput(inode);
@@ -10356,7 +10356,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
min_size, 0, *alloc_hint, &ins, 1, 0);
if (ret) {
if (own_trans)
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
break;
}
btrfs_dec_block_group_reservations(fs_info, ins.objectid);
@@ -10372,7 +10372,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
ins.offset, 0);
btrfs_abort_transaction(trans, ret);
if (own_trans)
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
break;
}
@@ -10432,12 +10432,12 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
if (ret) {
btrfs_abort_transaction(trans, ret);
if (own_trans)
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
break;
}
if (own_trans)
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
}
if (cur_offset < end)
btrfs_free_reserved_data_space(inode, cur_offset,
@@ -10542,7 +10542,7 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
mark_inode_dirty(inode);
out:
- btrfs_end_transaction(trans, root);
+ btrfs_end_transaction(trans);
if (ret)
iput(inode);
btrfs_balance_delayed_items(fs_info);