Commit 7a7eaa40 authored by Josef Bacik's avatar Josef Bacik

Btrfs: take away the num_items argument from btrfs_join_transaction

I keep forgetting that btrfs_join_transaction() just ignores the num_items
argument, which leads me to sending pointless patches and looking stupid :).  So
just kill the num_items argument from btrfs_join_transaction and
btrfs_start_ioctl_transaction, since neither of them use it.  Thanks,
Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
parent 74b21075
...@@ -1568,7 +1568,7 @@ static int transaction_kthread(void *arg) ...@@ -1568,7 +1568,7 @@ static int transaction_kthread(void *arg)
transid = cur->transid; transid = cur->transid;
spin_unlock(&root->fs_info->new_trans_lock); spin_unlock(&root->fs_info->new_trans_lock);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
if (transid == trans->transid) { if (transid == trans->transid) {
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
...@@ -2495,13 +2495,13 @@ int btrfs_commit_super(struct btrfs_root *root) ...@@ -2495,13 +2495,13 @@ int btrfs_commit_super(struct btrfs_root *root)
down_write(&root->fs_info->cleanup_work_sem); down_write(&root->fs_info->cleanup_work_sem);
up_write(&root->fs_info->cleanup_work_sem); up_write(&root->fs_info->cleanup_work_sem);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
BUG_ON(ret); BUG_ON(ret);
/* run commit again to drop the original snapshot */ /* run commit again to drop the original snapshot */
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
btrfs_commit_transaction(trans, root); btrfs_commit_transaction(trans, root);
......
...@@ -3174,7 +3174,7 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes) ...@@ -3174,7 +3174,7 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes)
spin_unlock(&data_sinfo->lock); spin_unlock(&data_sinfo->lock);
alloc: alloc:
alloc_target = btrfs_get_alloc_profile(root, 1); alloc_target = btrfs_get_alloc_profile(root, 1);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
...@@ -3202,7 +3202,7 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes) ...@@ -3202,7 +3202,7 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes)
commit_trans: commit_trans:
if (!committed && !root->fs_info->open_ioctl_trans) { if (!committed && !root->fs_info->open_ioctl_trans) {
committed = 1; committed = 1;
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
...@@ -3589,7 +3589,7 @@ static int reserve_metadata_bytes(struct btrfs_trans_handle *trans, ...@@ -3589,7 +3589,7 @@ static int reserve_metadata_bytes(struct btrfs_trans_handle *trans,
goto out; goto out;
ret = -ENOSPC; ret = -ENOSPC;
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
goto out; goto out;
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
...@@ -3816,7 +3816,7 @@ int btrfs_block_rsv_check(struct btrfs_trans_handle *trans, ...@@ -3816,7 +3816,7 @@ int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
if (trans) if (trans)
return -EAGAIN; return -EAGAIN;
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
return 0; return 0;
...@@ -7649,7 +7649,7 @@ int btrfs_drop_dead_reloc_roots(struct btrfs_root *root) ...@@ -7649,7 +7649,7 @@ int btrfs_drop_dead_reloc_roots(struct btrfs_root *root)
BUG_ON(reloc_root->commit_root != NULL); BUG_ON(reloc_root->commit_root != NULL);
while (1) { while (1) {
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
mutex_lock(&root->fs_info->drop_mutex); mutex_lock(&root->fs_info->drop_mutex);
...@@ -8176,7 +8176,7 @@ int btrfs_set_block_group_ro(struct btrfs_root *root, ...@@ -8176,7 +8176,7 @@ int btrfs_set_block_group_ro(struct btrfs_root *root,
BUG_ON(cache->ro); BUG_ON(cache->ro);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
alloc_flags = update_block_group_flags(root, cache->flags); alloc_flags = update_block_group_flags(root, cache->flags);
......
...@@ -420,7 +420,7 @@ static noinline int compress_file_range(struct inode *inode, ...@@ -420,7 +420,7 @@ static noinline int compress_file_range(struct inode *inode,
} }
} }
if (start == 0) { if (start == 0) {
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
trans->block_rsv = &root->fs_info->delalloc_block_rsv; trans->block_rsv = &root->fs_info->delalloc_block_rsv;
...@@ -617,7 +617,7 @@ static noinline int submit_compressed_extents(struct inode *inode, ...@@ -617,7 +617,7 @@ static noinline int submit_compressed_extents(struct inode *inode,
async_extent->start + async_extent->ram_size - 1, async_extent->start + async_extent->ram_size - 1,
GFP_NOFS); GFP_NOFS);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
trans->block_rsv = &root->fs_info->delalloc_block_rsv; trans->block_rsv = &root->fs_info->delalloc_block_rsv;
ret = btrfs_reserve_extent(trans, root, ret = btrfs_reserve_extent(trans, root,
...@@ -779,7 +779,7 @@ static noinline int cow_file_range(struct inode *inode, ...@@ -779,7 +779,7 @@ static noinline int cow_file_range(struct inode *inode,
int ret = 0; int ret = 0;
BUG_ON(root == root->fs_info->tree_root); BUG_ON(root == root->fs_info->tree_root);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
trans->block_rsv = &root->fs_info->delalloc_block_rsv; trans->block_rsv = &root->fs_info->delalloc_block_rsv;
...@@ -1056,9 +1056,9 @@ static noinline int run_delalloc_nocow(struct inode *inode, ...@@ -1056,9 +1056,9 @@ static noinline int run_delalloc_nocow(struct inode *inode,
BUG_ON(!path); BUG_ON(!path);
if (root == root->fs_info->tree_root) { if (root == root->fs_info->tree_root) {
nolock = true; nolock = true;
trans = btrfs_join_transaction_nolock(root, 1); trans = btrfs_join_transaction_nolock(root);
} else { } else {
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
} }
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
trans->block_rsv = &root->fs_info->delalloc_block_rsv; trans->block_rsv = &root->fs_info->delalloc_block_rsv;
...@@ -1718,9 +1718,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) ...@@ -1718,9 +1718,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent);
if (!ret) { if (!ret) {
if (nolock) if (nolock)
trans = btrfs_join_transaction_nolock(root, 1); trans = btrfs_join_transaction_nolock(root);
else else
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
trans->block_rsv = &root->fs_info->delalloc_block_rsv; trans->block_rsv = &root->fs_info->delalloc_block_rsv;
...@@ -1735,9 +1735,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) ...@@ -1735,9 +1735,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
0, &cached_state, GFP_NOFS); 0, &cached_state, GFP_NOFS);
if (nolock) if (nolock)
trans = btrfs_join_transaction_nolock(root, 1); trans = btrfs_join_transaction_nolock(root);
else else
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
trans->block_rsv = &root->fs_info->delalloc_block_rsv; trans->block_rsv = &root->fs_info->delalloc_block_rsv;
...@@ -2415,7 +2415,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) ...@@ -2415,7 +2415,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
(u64)-1); (u64)-1);
if (root->orphan_block_rsv || root->orphan_item_inserted) { if (root->orphan_block_rsv || root->orphan_item_inserted) {
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (!IS_ERR(trans)) if (!IS_ERR(trans))
btrfs_end_transaction(trans, root); btrfs_end_transaction(trans, root);
} }
...@@ -4378,9 +4378,9 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -4378,9 +4378,9 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
if (wbc->sync_mode == WB_SYNC_ALL) { if (wbc->sync_mode == WB_SYNC_ALL) {
if (nolock) if (nolock)
trans = btrfs_join_transaction_nolock(root, 1); trans = btrfs_join_transaction_nolock(root);
else else
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
...@@ -4407,7 +4407,7 @@ void btrfs_dirty_inode(struct inode *inode) ...@@ -4407,7 +4407,7 @@ void btrfs_dirty_inode(struct inode *inode)
if (BTRFS_I(inode)->dummy_inode) if (BTRFS_I(inode)->dummy_inode)
return; return;
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
...@@ -5226,7 +5226,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -5226,7 +5226,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
free_extent_map(em); free_extent_map(em);
em = NULL; em = NULL;
btrfs_release_path(root, path); btrfs_release_path(root, path);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return ERR_CAST(trans); return ERR_CAST(trans);
goto again; goto again;
...@@ -5470,7 +5470,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, ...@@ -5470,7 +5470,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode,
btrfs_drop_extent_cache(inode, start, start + len - 1, 0); btrfs_drop_extent_cache(inode, start, start + len - 1, 0);
} }
trans = btrfs_join_transaction(root, 0); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return ERR_CAST(trans); return ERR_CAST(trans);
...@@ -5703,7 +5703,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, ...@@ -5703,7 +5703,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
* to make sure the current transaction stays open * to make sure the current transaction stays open
* while we look for nocow cross refs * while we look for nocow cross refs
*/ */
trans = btrfs_join_transaction(root, 0); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
goto must_cow; goto must_cow;
...@@ -5841,7 +5841,7 @@ static void btrfs_endio_direct_write(struct bio *bio, int err) ...@@ -5841,7 +5841,7 @@ static void btrfs_endio_direct_write(struct bio *bio, int err)
BUG_ON(!ordered); BUG_ON(!ordered);
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) { if (IS_ERR(trans)) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
......
...@@ -242,7 +242,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) ...@@ -242,7 +242,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
ip->flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS); ip->flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS);
} }
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, root, inode);
...@@ -2182,7 +2182,7 @@ static long btrfs_ioctl_trans_start(struct file *file) ...@@ -2182,7 +2182,7 @@ static long btrfs_ioctl_trans_start(struct file *file)
mutex_unlock(&root->fs_info->trans_mutex); mutex_unlock(&root->fs_info->trans_mutex);
ret = -ENOMEM; ret = -ENOMEM;
trans = btrfs_start_ioctl_transaction(root, 0); trans = btrfs_start_ioctl_transaction(root);
if (IS_ERR(trans)) if (IS_ERR(trans))
goto out_drop; goto out_drop;
......
...@@ -2149,7 +2149,7 @@ int prepare_to_merge(struct reloc_control *rc, int err) ...@@ -2149,7 +2149,7 @@ int prepare_to_merge(struct reloc_control *rc, int err)
err = ret; err = ret;
} }
trans = btrfs_join_transaction(rc->extent_root, 1); trans = btrfs_join_transaction(rc->extent_root);
if (IS_ERR(trans)) { if (IS_ERR(trans)) {
if (!err) if (!err)
btrfs_block_rsv_release(rc->extent_root, btrfs_block_rsv_release(rc->extent_root,
...@@ -3233,7 +3233,7 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info, ...@@ -3233,7 +3233,7 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info,
goto out; goto out;
} }
trans = btrfs_join_transaction(root, 0); trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) { if (IS_ERR(trans)) {
btrfs_free_path(path); btrfs_free_path(path);
ret = PTR_ERR(trans); ret = PTR_ERR(trans);
...@@ -3642,7 +3642,7 @@ int prepare_to_relocate(struct reloc_control *rc) ...@@ -3642,7 +3642,7 @@ int prepare_to_relocate(struct reloc_control *rc)
rc->create_reloc_tree = 1; rc->create_reloc_tree = 1;
set_reloc_control(rc); set_reloc_control(rc);
trans = btrfs_join_transaction(rc->extent_root, 1); trans = btrfs_join_transaction(rc->extent_root);
BUG_ON(IS_ERR(trans)); BUG_ON(IS_ERR(trans));
btrfs_commit_transaction(trans, rc->extent_root); btrfs_commit_transaction(trans, rc->extent_root);
return 0; return 0;
...@@ -3831,7 +3831,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3831,7 +3831,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
btrfs_block_rsv_release(rc->extent_root, rc->block_rsv, (u64)-1); btrfs_block_rsv_release(rc->extent_root, rc->block_rsv, (u64)-1);
/* get rid of pinned extents */ /* get rid of pinned extents */
trans = btrfs_join_transaction(rc->extent_root, 1); trans = btrfs_join_transaction(rc->extent_root);
if (IS_ERR(trans)) if (IS_ERR(trans))
err = PTR_ERR(trans); err = PTR_ERR(trans);
else else
...@@ -4156,7 +4156,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) ...@@ -4156,7 +4156,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
set_reloc_control(rc); set_reloc_control(rc);
trans = btrfs_join_transaction(rc->extent_root, 1); trans = btrfs_join_transaction(rc->extent_root);
if (IS_ERR(trans)) { if (IS_ERR(trans)) {
unset_reloc_control(rc); unset_reloc_control(rc);
err = PTR_ERR(trans); err = PTR_ERR(trans);
...@@ -4190,7 +4190,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) ...@@ -4190,7 +4190,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
unset_reloc_control(rc); unset_reloc_control(rc);
trans = btrfs_join_transaction(rc->extent_root, 1); trans = btrfs_join_transaction(rc->extent_root);
if (IS_ERR(trans)) if (IS_ERR(trans))
err = PTR_ERR(trans); err = PTR_ERR(trans);
else else
......
...@@ -257,22 +257,19 @@ struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, ...@@ -257,22 +257,19 @@ struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
{ {
return start_transaction(root, num_items, TRANS_START); return start_transaction(root, num_items, TRANS_START);
} }
struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root, struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root)
int num_blocks)
{ {
return start_transaction(root, 0, TRANS_JOIN); return start_transaction(root, 0, TRANS_JOIN);
} }
struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root, struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root)
int num_blocks)
{ {
return start_transaction(root, 0, TRANS_JOIN_NOLOCK); return start_transaction(root, 0, TRANS_JOIN_NOLOCK);
} }
struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *r, struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *root)
int num_blocks)
{ {
return start_transaction(r, 0, TRANS_USERSPACE); return start_transaction(root, 0, TRANS_USERSPACE);
} }
/* wait for a transaction commit to be fully complete */ /* wait for a transaction commit to be fully complete */
...@@ -1171,7 +1168,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, ...@@ -1171,7 +1168,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
INIT_DELAYED_WORK(&ac->work, do_async_commit); INIT_DELAYED_WORK(&ac->work, do_async_commit);
ac->root = root; ac->root = root;
ac->newtrans = btrfs_join_transaction(root, 0); ac->newtrans = btrfs_join_transaction(root);
if (IS_ERR(ac->newtrans)) { if (IS_ERR(ac->newtrans)) {
int err = PTR_ERR(ac->newtrans); int err = PTR_ERR(ac->newtrans);
kfree(ac); kfree(ac);
......
...@@ -92,12 +92,9 @@ int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans, ...@@ -92,12 +92,9 @@ int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans,
struct btrfs_root *root); struct btrfs_root *root);
struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
int num_items); int num_items);
struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root, struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root);
int num_blocks); struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root);
struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root, struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *root);
int num_blocks);
struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *r,
int num_blocks);
int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid); int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid);
int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
struct btrfs_root *root); struct btrfs_root *root);
......
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