Commit 32cc4f87 authored by David Sterba's avatar David Sterba

btrfs: sink wait_for_unblock parameter to async commit

There's only one caller left btrfs_ioctl_start_sync that passes 0, so we
can remove the switch in btrfs_commit_transaction_async.

A cleanup 9babda9f ("btrfs: Remove async_transid from
btrfs_mksubvol/create_subvol/create_snapshot") removed calls that passed
1, so this is a followup.

As this removes last call of wait_current_trans_commit_start_and_unblock,
remove the function as well.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent bfaa324e
...@@ -3643,7 +3643,7 @@ static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root, ...@@ -3643,7 +3643,7 @@ static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root,
goto out; goto out;
} }
transid = trans->transid; transid = trans->transid;
ret = btrfs_commit_transaction_async(trans, 0); ret = btrfs_commit_transaction_async(trans);
if (ret) { if (ret) {
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
return ret; return ret;
......
...@@ -1882,19 +1882,6 @@ static void wait_current_trans_commit_start(struct btrfs_fs_info *fs_info, ...@@ -1882,19 +1882,6 @@ static void wait_current_trans_commit_start(struct btrfs_fs_info *fs_info,
TRANS_ABORTED(trans)); TRANS_ABORTED(trans));
} }
/*
* wait for the current transaction to start and then become unblocked.
* caller holds ref.
*/
static void wait_current_trans_commit_start_and_unblock(
struct btrfs_fs_info *fs_info,
struct btrfs_transaction *trans)
{
wait_event(fs_info->transaction_wait,
trans->state >= TRANS_STATE_UNBLOCKED ||
TRANS_ABORTED(trans));
}
/* /*
* commit transactions asynchronously. once btrfs_commit_transaction_async * commit transactions asynchronously. once btrfs_commit_transaction_async
* returns, any subsequent transaction will not be allowed to join. * returns, any subsequent transaction will not be allowed to join.
...@@ -1922,8 +1909,7 @@ static void do_async_commit(struct work_struct *work) ...@@ -1922,8 +1909,7 @@ static void do_async_commit(struct work_struct *work)
kfree(ac); kfree(ac);
} }
int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans)
int wait_for_unblock)
{ {
struct btrfs_fs_info *fs_info = trans->fs_info; struct btrfs_fs_info *fs_info = trans->fs_info;
struct btrfs_async_commit *ac; struct btrfs_async_commit *ac;
...@@ -1955,13 +1941,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, ...@@ -1955,13 +1941,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
__sb_writers_release(fs_info->sb, SB_FREEZE_FS); __sb_writers_release(fs_info->sb, SB_FREEZE_FS);
schedule_work(&ac->work); schedule_work(&ac->work);
wait_current_trans_commit_start(fs_info, cur_trans);
/* wait for transaction to start and unblock */
if (wait_for_unblock)
wait_current_trans_commit_start_and_unblock(fs_info, cur_trans);
else
wait_current_trans_commit_start(fs_info, cur_trans);
if (current->journal_info == trans) if (current->journal_info == trans)
current->journal_info = NULL; current->journal_info = NULL;
......
...@@ -226,8 +226,7 @@ void btrfs_add_dead_root(struct btrfs_root *root); ...@@ -226,8 +226,7 @@ void btrfs_add_dead_root(struct btrfs_root *root);
int btrfs_defrag_root(struct btrfs_root *root); int btrfs_defrag_root(struct btrfs_root *root);
int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root);
int btrfs_commit_transaction(struct btrfs_trans_handle *trans); int btrfs_commit_transaction(struct btrfs_trans_handle *trans);
int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans);
int wait_for_unblock);
int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans); int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans);
bool btrfs_should_end_transaction(struct btrfs_trans_handle *trans); bool btrfs_should_end_transaction(struct btrfs_trans_handle *trans);
void btrfs_throttle(struct btrfs_fs_info *fs_info); void btrfs_throttle(struct btrfs_fs_info *fs_info);
......
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