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>
This commit is contained in:
Jeff Mahoney
2016-09-09 21:39:03 -04:00
committed by David Sterba
parent bf89d38feb
commit 3a45bb207e
22 changed files with 188 additions and 211 deletions

View File

@@ -2868,7 +2868,7 @@ static void delayed_ref_async_start(struct btrfs_work *work)
if (ret)
async->error = ret;
end:
ret = btrfs_end_transaction(trans, async->root);
ret = btrfs_end_transaction(trans);
if (ret && !async->error)
async->error = ret;
done:
@@ -4175,7 +4175,7 @@ alloc:
ret = do_chunk_alloc(trans, fs_info, alloc_target,
CHUNK_ALLOC_NO_FORCE);
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
if (ret < 0) {
if (ret != -ENOSPC)
return ret;
@@ -4220,7 +4220,7 @@ commit_trans:
test_bit(BTRFS_TRANS_HAVE_FREE_BGS,
&trans->transaction->flags) ||
need_commit > 0) {
ret = btrfs_commit_transaction(trans, root);
ret = btrfs_commit_transaction(trans);
if (ret)
return ret;
/*
@@ -4232,7 +4232,7 @@ commit_trans:
mutex_unlock(&fs_info->cleaner_delayed_iput_mutex);
goto again;
} else {
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
}
}
@@ -4824,7 +4824,7 @@ commit:
if (IS_ERR(trans))
return -ENOSPC;
return btrfs_commit_transaction(trans, root);
return btrfs_commit_transaction(trans);
}
struct reserve_ticket {
@@ -4857,7 +4857,7 @@ static int flush_space(struct btrfs_root *root,
break;
}
ret = btrfs_run_delayed_items_nr(trans, fs_info, nr);
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
break;
case FLUSH_DELALLOC:
case FLUSH_DELALLOC_WAIT:
@@ -4873,7 +4873,7 @@ static int flush_space(struct btrfs_root *root,
ret = do_chunk_alloc(trans, fs_info,
btrfs_get_alloc_profile(root, 0),
CHUNK_ALLOC_NO_FORCE);
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
if (ret > 0 || ret == -ENOSPC)
ret = 0;
break;
@@ -7854,7 +7854,7 @@ loop:
else
ret = 0;
if (!exist)
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
if (ret)
goto out;
}
@@ -9106,7 +9106,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
}
BUG_ON(wc->level == 0);
if (btrfs_should_end_transaction(trans, tree_root) ||
if (btrfs_should_end_transaction(trans) ||
(!for_reloc && btrfs_need_cleaner_sleep(fs_info))) {
ret = btrfs_update_root(trans, tree_root,
&root->root_key,
@@ -9117,7 +9117,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
goto out_end_trans;
}
btrfs_end_transaction_throttle(trans, tree_root);
btrfs_end_transaction_throttle(trans);
if (!for_reloc && btrfs_need_cleaner_sleep(fs_info)) {
btrfs_debug(fs_info,
"drop snapshot early exit");
@@ -9171,7 +9171,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
}
root_dropped = true;
out_end_trans:
btrfs_end_transaction_throttle(trans, tree_root);
btrfs_end_transaction_throttle(trans);
out_free:
kfree(wc);
btrfs_free_path(path);
@@ -9380,7 +9380,7 @@ again:
u64 transid = trans->transid;
mutex_unlock(&fs_info->ro_block_group_mutex);
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
ret = btrfs_wait_for_commit(fs_info, transid);
if (ret)
@@ -9425,7 +9425,7 @@ out:
}
mutex_unlock(&fs_info->ro_block_group_mutex);
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
return ret;
}
@@ -9644,7 +9644,7 @@ int btrfs_can_relocate(struct btrfs_fs_info *fs_info, u64 bytenr)
"no space to allocate a new chunk for block group %llu",
block_group->key.objectid);
mutex_unlock(&fs_info->chunk_mutex);
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
out:
btrfs_put_block_group(block_group);
return ret;
@@ -10596,7 +10596,6 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
{
struct btrfs_block_group_cache *block_group;
struct btrfs_space_info *space_info;
struct btrfs_root *root = fs_info->extent_root;
struct btrfs_trans_handle *trans;
int ret = 0;
@@ -10747,7 +10746,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
btrfs_get_block_group(block_group);
}
end_trans:
btrfs_end_transaction(trans, root);
btrfs_end_transaction(trans);
next:
mutex_unlock(&fs_info->delete_unused_bgs_mutex);
btrfs_put_block_group(block_group);