btrfs: btrfs_abort_transaction, drop root parameter
__btrfs_abort_transaction doesn't use its root parameter except to obtain an fs_info pointer. We can obtain that from trans->root->fs_info for now and from trans->fs_info in a later patch. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
64b6358072
commit
66642832f0
@@ -296,7 +296,7 @@ static noinline int cow_file_range_inline(struct btrfs_root *root,
|
||||
start, aligned_end, NULL,
|
||||
1, 1, extent_item_size, &extent_inserted);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ static noinline int cow_file_range_inline(struct btrfs_root *root,
|
||||
inline_len, compressed_size,
|
||||
compress_type, compressed_pages);
|
||||
if (ret && ret != -ENOSPC) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
} else if (ret == -ENOSPC) {
|
||||
ret = 1;
|
||||
@@ -2603,7 +2603,7 @@ again:
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
||||
sizeof(*extent));
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_free_path;
|
||||
}
|
||||
|
||||
@@ -2630,7 +2630,7 @@ again:
|
||||
backref->root_id, backref->inum,
|
||||
new->file_pos); /* start - extent_offset */
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_free_path;
|
||||
}
|
||||
|
||||
@@ -2899,7 +2899,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
|
||||
trans->block_rsv = &root->fs_info->delalloc_block_rsv;
|
||||
ret = btrfs_update_inode_fallback(trans, root, inode);
|
||||
if (ret) /* -ENOMEM or corruption */
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2959,7 +2959,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
|
||||
ordered_extent->file_offset, ordered_extent->len,
|
||||
trans->transid);
|
||||
if (ret < 0) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
@@ -2969,7 +2969,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
|
||||
btrfs_ordered_update_i_size(inode, 0, ordered_extent);
|
||||
ret = btrfs_update_inode_fallback(trans, root, inode);
|
||||
if (ret) { /* -ENOMEM or corruption */
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
ret = 0;
|
||||
@@ -3213,7 +3213,7 @@ void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans,
|
||||
ret = btrfs_del_orphan_item(trans, root->fs_info->tree_root,
|
||||
root->root_key.objectid);
|
||||
if (ret)
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
else
|
||||
clear_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED,
|
||||
&root->state);
|
||||
@@ -3304,7 +3304,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
|
||||
if (ret != -EEXIST) {
|
||||
clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
|
||||
&BTRFS_I(inode)->runtime_flags);
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -3316,7 +3316,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
|
||||
ret = btrfs_insert_orphan_item(trans, root->fs_info->tree_root,
|
||||
root->root_key.objectid);
|
||||
if (ret && ret != -EEXIST) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -4015,20 +4015,20 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
|
||||
btrfs_info(root->fs_info,
|
||||
"failed to delete reference to %.*s, inode %llu parent %llu",
|
||||
name_len, name, ino, dir_ino);
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto err;
|
||||
}
|
||||
skip_backref:
|
||||
ret = btrfs_delete_delayed_dir_index(trans, root, dir, index);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len,
|
||||
inode, dir_ino);
|
||||
if (ret != 0 && ret != -ENOENT) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -4037,7 +4037,7 @@ skip_backref:
|
||||
if (ret == -ENOENT)
|
||||
ret = 0;
|
||||
else if (ret)
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
err:
|
||||
btrfs_free_path(path);
|
||||
if (ret)
|
||||
@@ -4151,7 +4151,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
|
||||
WARN_ON(key.type != BTRFS_ROOT_ITEM_KEY || key.objectid != objectid);
|
||||
ret = btrfs_delete_one_dir_name(trans, root, path, di);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
btrfs_release_path(path);
|
||||
@@ -4161,7 +4161,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
|
||||
dir_ino, &index, name, name_len);
|
||||
if (ret < 0) {
|
||||
if (ret != -ENOENT) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
di = btrfs_search_dir_index_item(root, path, dir_ino,
|
||||
@@ -4171,7 +4171,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
|
||||
ret = -ENOENT;
|
||||
else
|
||||
ret = PTR_ERR(di);
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -4184,7 +4184,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
|
||||
|
||||
ret = btrfs_delete_delayed_dir_index(trans, root, dir, index);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -4193,7 +4193,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
|
||||
dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
|
||||
ret = btrfs_update_inode_fallback(trans, root, dir);
|
||||
if (ret)
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
out:
|
||||
btrfs_free_path(path);
|
||||
return ret;
|
||||
@@ -4514,7 +4514,6 @@ search_again:
|
||||
pending_del_nr);
|
||||
if (err) {
|
||||
btrfs_abort_transaction(trans,
|
||||
root,
|
||||
err);
|
||||
goto error;
|
||||
}
|
||||
@@ -4526,8 +4525,7 @@ search_again:
|
||||
item_end,
|
||||
new_size);
|
||||
if (err) {
|
||||
btrfs_abort_transaction(trans,
|
||||
root, err);
|
||||
btrfs_abort_transaction(trans, err);
|
||||
goto error;
|
||||
}
|
||||
} else if (test_bit(BTRFS_ROOT_REF_COWS,
|
||||
@@ -4591,8 +4589,7 @@ delete:
|
||||
pending_del_slot,
|
||||
pending_del_nr);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans,
|
||||
root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto error;
|
||||
}
|
||||
pending_del_nr = 0;
|
||||
@@ -4625,7 +4622,7 @@ out:
|
||||
ret = btrfs_del_items(trans, root, path, pending_del_slot,
|
||||
pending_del_nr);
|
||||
if (ret)
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
}
|
||||
error:
|
||||
if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID)
|
||||
@@ -4794,7 +4791,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, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
btrfs_end_transaction(trans, root);
|
||||
return ret;
|
||||
}
|
||||
@@ -4802,7 +4799,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
|
||||
ret = btrfs_insert_file_extent(trans, root, btrfs_ino(inode), offset,
|
||||
0, 0, len, 0, len, 0, 0, 0);
|
||||
if (ret)
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
else
|
||||
btrfs_update_inode(trans, root, inode);
|
||||
btrfs_end_transaction(trans, root);
|
||||
@@ -5029,7 +5026,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
|
||||
i_size_write(inode, BTRFS_I(inode)->disk_i_size);
|
||||
err = btrfs_orphan_del(trans, inode);
|
||||
if (err)
|
||||
btrfs_abort_transaction(trans, root, err);
|
||||
btrfs_abort_transaction(trans, err);
|
||||
btrfs_end_transaction(trans, root);
|
||||
}
|
||||
}
|
||||
@@ -6335,7 +6332,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
|
||||
if (ret == -EEXIST || ret == -EOVERFLOW)
|
||||
goto fail_dir_item;
|
||||
else if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -6346,7 +6343,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
|
||||
current_fs_time(parent_inode->i_sb);
|
||||
ret = btrfs_update_inode(trans, root, parent_inode);
|
||||
if (ret)
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
|
||||
fail_dir_item:
|
||||
@@ -9568,7 +9565,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
||||
ret = btrfs_update_inode(trans, root, old_inode);
|
||||
}
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
@@ -9588,7 +9585,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
||||
ret = btrfs_update_inode(trans, dest, new_inode);
|
||||
}
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
@@ -9596,7 +9593,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
||||
new_dentry->d_name.name,
|
||||
new_dentry->d_name.len, 0, old_idx);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
@@ -9604,7 +9601,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
||||
old_dentry->d_name.name,
|
||||
old_dentry->d_name.len, 0, new_idx);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
@@ -9843,7 +9840,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
ret = btrfs_update_inode(trans, root, old_inode);
|
||||
}
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
@@ -9867,7 +9864,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
if (!ret && new_inode->i_nlink == 0)
|
||||
ret = btrfs_orphan_add(trans, d_inode(new_dentry));
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
}
|
||||
@@ -9876,7 +9873,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
new_dentry->d_name.name,
|
||||
new_dentry->d_name.len, 0, index);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
@@ -9896,7 +9893,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
old_dentry);
|
||||
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_fail;
|
||||
}
|
||||
}
|
||||
@@ -10322,7 +10319,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
|
||||
if (ret) {
|
||||
btrfs_free_reserved_extent(root, ins.objectid,
|
||||
ins.offset, 0);
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
if (own_trans)
|
||||
btrfs_end_transaction(trans, root);
|
||||
break;
|
||||
@@ -10382,7 +10379,7 @@ next:
|
||||
ret = btrfs_update_inode(trans, root, inode);
|
||||
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, root, ret);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
if (own_trans)
|
||||
btrfs_end_transaction(trans, root);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user