Commit c79a70b1 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: drop fs_info parameter from btrfs_run_delayed_refs

It's provided by the transaction handle.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 39d7d09d
...@@ -2623,7 +2623,7 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr); ...@@ -2623,7 +2623,7 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr);
void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg); void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg);
void btrfs_put_block_group(struct btrfs_block_group_cache *cache); void btrfs_put_block_group(struct btrfs_block_group_cache *cache);
int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, unsigned long count); unsigned long count);
int btrfs_async_run_delayed_refs(struct btrfs_fs_info *fs_info, int btrfs_async_run_delayed_refs(struct btrfs_fs_info *fs_info,
unsigned long count, u64 transid, int wait); unsigned long count, u64 transid, int wait);
int btrfs_lookup_data_extent(struct btrfs_fs_info *fs_info, u64 start, u64 len); int btrfs_lookup_data_extent(struct btrfs_fs_info *fs_info, u64 start, u64 len);
......
...@@ -2992,7 +2992,7 @@ static void delayed_ref_async_start(struct btrfs_work *work) ...@@ -2992,7 +2992,7 @@ static void delayed_ref_async_start(struct btrfs_work *work)
if (trans->transid > async->transid) if (trans->transid > async->transid)
goto end; goto end;
ret = btrfs_run_delayed_refs(trans, fs_info, async->count); ret = btrfs_run_delayed_refs(trans, async->count);
if (ret) if (ret)
async->error = ret; async->error = ret;
end: end:
...@@ -3051,8 +3051,9 @@ int btrfs_async_run_delayed_refs(struct btrfs_fs_info *fs_info, ...@@ -3051,8 +3051,9 @@ int btrfs_async_run_delayed_refs(struct btrfs_fs_info *fs_info,
* Returns <0 on error and aborts the transaction * Returns <0 on error and aborts the transaction
*/ */
int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, unsigned long count) unsigned long count)
{ {
struct btrfs_fs_info *fs_info = trans->fs_info;
struct rb_node *node; struct rb_node *node;
struct btrfs_delayed_ref_root *delayed_refs; struct btrfs_delayed_ref_root *delayed_refs;
struct btrfs_delayed_ref_head *head; struct btrfs_delayed_ref_head *head;
...@@ -3799,7 +3800,7 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans) ...@@ -3799,7 +3800,7 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans)
* go through delayed refs for all the stuff we've just kicked off * go through delayed refs for all the stuff we've just kicked off
* and then loop back (just once) * and then loop back (just once)
*/ */
ret = btrfs_run_delayed_refs(trans, fs_info, 0); ret = btrfs_run_delayed_refs(trans, 0);
if (!ret && loops == 0) { if (!ret && loops == 0) {
loops++; loops++;
spin_lock(&cur_trans->dirty_bgs_lock); spin_lock(&cur_trans->dirty_bgs_lock);
...@@ -3881,7 +3882,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, ...@@ -3881,7 +3882,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
cache_save_setup(cache, trans, path); cache_save_setup(cache, trans, path);
if (!ret) if (!ret)
ret = btrfs_run_delayed_refs(trans, fs_info, ret = btrfs_run_delayed_refs(trans,
(unsigned long) -1); (unsigned long) -1);
if (!ret && cache->disk_cache_state == BTRFS_DC_SETUP) { if (!ret && cache->disk_cache_state == BTRFS_DC_SETUP) {
......
...@@ -4730,7 +4730,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -4730,7 +4730,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
if (updates) { if (updates) {
trans->delayed_ref_updates = 0; trans->delayed_ref_updates = 0;
ret = btrfs_run_delayed_refs(trans, ret = btrfs_run_delayed_refs(trans,
fs_info,
updates * 2); updates * 2);
if (ret && !err) if (ret && !err)
err = ret; err = ret;
...@@ -4770,8 +4769,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -4770,8 +4769,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
unsigned long updates = trans->delayed_ref_updates; unsigned long updates = trans->delayed_ref_updates;
if (updates) { if (updates) {
trans->delayed_ref_updates = 0; trans->delayed_ref_updates = 0;
ret = btrfs_run_delayed_refs(trans, fs_info, ret = btrfs_run_delayed_refs(trans, updates * 2);
updates * 2);
if (ret && !err) if (ret && !err)
err = ret; err = ret;
} }
......
...@@ -781,7 +781,6 @@ static int should_end_transaction(struct btrfs_trans_handle *trans) ...@@ -781,7 +781,6 @@ static int should_end_transaction(struct btrfs_trans_handle *trans)
int btrfs_should_end_transaction(struct btrfs_trans_handle *trans) int btrfs_should_end_transaction(struct btrfs_trans_handle *trans)
{ {
struct btrfs_transaction *cur_trans = trans->transaction; struct btrfs_transaction *cur_trans = trans->transaction;
struct btrfs_fs_info *fs_info = trans->fs_info;
int updates; int updates;
int err; int err;
...@@ -793,7 +792,7 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans) ...@@ -793,7 +792,7 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans)
updates = trans->delayed_ref_updates; updates = trans->delayed_ref_updates;
trans->delayed_ref_updates = 0; trans->delayed_ref_updates = 0;
if (updates) { if (updates) {
err = btrfs_run_delayed_refs(trans, fs_info, updates * 2); err = btrfs_run_delayed_refs(trans, updates * 2);
if (err) /* Error code will also eval true */ if (err) /* Error code will also eval true */
return err; return err;
} }
...@@ -1161,7 +1160,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans) ...@@ -1161,7 +1160,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans)
if (ret) if (ret)
return ret; return ret;
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) if (ret)
return ret; return ret;
...@@ -1180,7 +1179,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans) ...@@ -1180,7 +1179,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans)
return ret; return ret;
/* run_qgroups might have added some more refs */ /* run_qgroups might have added some more refs */
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) if (ret)
return ret; return ret;
again: again:
...@@ -1197,7 +1196,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans) ...@@ -1197,7 +1196,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans)
ret = update_cowonly_root(trans, root); ret = update_cowonly_root(trans, root);
if (ret) if (ret)
return ret; return ret;
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1206,7 +1205,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans) ...@@ -1206,7 +1205,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans)
ret = btrfs_write_dirty_block_groups(trans, fs_info); ret = btrfs_write_dirty_block_groups(trans, fs_info);
if (ret) if (ret)
return ret; return ret;
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1617,7 +1616,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, ...@@ -1617,7 +1616,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
goto fail; goto fail;
} }
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto fail; goto fail;
...@@ -1671,7 +1670,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, ...@@ -1671,7 +1670,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
} }
} }
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto fail; goto fail;
...@@ -1954,7 +1953,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) ...@@ -1954,7 +1953,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
/* make a pass through all the delayed refs we have so far /* make a pass through all the delayed refs we have so far
* any runnings procs may add more while we are here * any runnings procs may add more while we are here
*/ */
ret = btrfs_run_delayed_refs(trans, fs_info, 0); ret = btrfs_run_delayed_refs(trans, 0);
if (ret) { if (ret) {
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
return ret; return ret;
...@@ -1975,7 +1974,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) ...@@ -1975,7 +1974,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
if (!list_empty(&trans->new_bgs)) if (!list_empty(&trans->new_bgs))
btrfs_create_pending_block_groups(trans); btrfs_create_pending_block_groups(trans);
ret = btrfs_run_delayed_refs(trans, fs_info, 0); ret = btrfs_run_delayed_refs(trans, 0);
if (ret) { if (ret) {
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
return ret; return ret;
...@@ -2124,7 +2123,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) ...@@ -2124,7 +2123,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
goto scrub_continue; goto scrub_continue;
} }
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) { if (ret) {
mutex_unlock(&fs_info->reloc_mutex); mutex_unlock(&fs_info->reloc_mutex);
goto scrub_continue; goto scrub_continue;
...@@ -2175,7 +2174,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) ...@@ -2175,7 +2174,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
* commit_fs_roots() can call btrfs_save_ino_cache(), which generates * commit_fs_roots() can call btrfs_save_ino_cache(), which generates
* new delayed refs. Must handle them or qgroup can be wrong. * new delayed refs. Must handle them or qgroup can be wrong.
*/ */
ret = btrfs_run_delayed_refs(trans, fs_info, (unsigned long)-1); ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
if (ret) { if (ret) {
mutex_unlock(&fs_info->tree_log_mutex); mutex_unlock(&fs_info->tree_log_mutex);
mutex_unlock(&fs_info->reloc_mutex); mutex_unlock(&fs_info->reloc_mutex);
......
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