Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262241
b: refs/heads/master
c: 72d63ed
h: refs/heads/master
i:
  262239: cc2760f
v: v3
  • Loading branch information
Li Zefan authored and Chris Mason committed Aug 1, 2011
1 parent ca73d5e commit 871c258
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 53 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e55179b3d7d41d83fd6b5f59325f4a8d8ac9700a
refs/heads/master: 72d63ed6427cf233e2b352c0b80c3e5c5a444986
59 changes: 7 additions & 52 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,11 @@ static void wait_current_trans(struct btrfs_root *root)
spin_lock(&root->fs_info->trans_lock);
cur_trans = root->fs_info->running_transaction;
if (cur_trans && cur_trans->blocked) {
DEFINE_WAIT(wait);
atomic_inc(&cur_trans->use_count);
spin_unlock(&root->fs_info->trans_lock);
while (1) {
prepare_to_wait(&root->fs_info->transaction_wait, &wait,
TASK_UNINTERRUPTIBLE);
if (!cur_trans->blocked)
break;
schedule();
}
finish_wait(&root->fs_info->transaction_wait, &wait);

wait_event(root->fs_info->transaction_wait,
!cur_trans->blocked);
put_transaction(cur_trans);
} else {
spin_unlock(&root->fs_info->trans_lock);
Expand Down Expand Up @@ -360,15 +354,7 @@ struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *root
static noinline int wait_for_commit(struct btrfs_root *root,
struct btrfs_transaction *commit)
{
DEFINE_WAIT(wait);
while (!commit->commit_done) {
prepare_to_wait(&commit->commit_wait, &wait,
TASK_UNINTERRUPTIBLE);
if (commit->commit_done)
break;
schedule();
}
finish_wait(&commit->commit_wait, &wait);
wait_event(commit->commit_wait, commit->commit_done);
return 0;
}

Expand Down Expand Up @@ -1085,22 +1071,7 @@ int btrfs_transaction_blocked(struct btrfs_fs_info *info)
static void wait_current_trans_commit_start(struct btrfs_root *root,
struct btrfs_transaction *trans)
{
DEFINE_WAIT(wait);

if (trans->in_commit)
return;

while (1) {
prepare_to_wait(&root->fs_info->transaction_blocked_wait, &wait,
TASK_UNINTERRUPTIBLE);
if (trans->in_commit) {
finish_wait(&root->fs_info->transaction_blocked_wait,
&wait);
break;
}
schedule();
finish_wait(&root->fs_info->transaction_blocked_wait, &wait);
}
wait_event(root->fs_info->transaction_blocked_wait, trans->in_commit);
}

/*
Expand All @@ -1110,24 +1081,8 @@ static void wait_current_trans_commit_start(struct btrfs_root *root,
static void wait_current_trans_commit_start_and_unblock(struct btrfs_root *root,
struct btrfs_transaction *trans)
{
DEFINE_WAIT(wait);

if (trans->commit_done || (trans->in_commit && !trans->blocked))
return;

while (1) {
prepare_to_wait(&root->fs_info->transaction_wait, &wait,
TASK_UNINTERRUPTIBLE);
if (trans->commit_done ||
(trans->in_commit && !trans->blocked)) {
finish_wait(&root->fs_info->transaction_wait,
&wait);
break;
}
schedule();
finish_wait(&root->fs_info->transaction_wait,
&wait);
}
wait_event(root->fs_info->transaction_wait,
trans->commit_done || (trans->in_commit && !trans->blocked));
}

/*
Expand Down

0 comments on commit 871c258

Please sign in to comment.