Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346705
b: refs/heads/master
c: 8cd2807
h: refs/heads/master
i:
  346703: a8bdc95
v: v3
  • Loading branch information
Miao Xie authored and Chris Mason committed Dec 17, 2012
1 parent 5ac26b6 commit 4ac8c24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: ff7c1d33551862c86f7737fe88edc3e499d291e6
refs/heads/master: 8cd2807f79b73ef2d8c1cb6b3732dc5758ac7212
15 changes: 8 additions & 7 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,28 +456,31 @@ static noinline void wait_for_commit(struct btrfs_root *root,
int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid)
{
struct btrfs_transaction *cur_trans = NULL, *t;
int ret;
int ret = 0;

ret = 0;
if (transid) {
if (transid <= root->fs_info->last_trans_committed)
goto out;

ret = -EINVAL;
/* find specified transaction */
spin_lock(&root->fs_info->trans_lock);
list_for_each_entry(t, &root->fs_info->trans_list, list) {
if (t->transid == transid) {
cur_trans = t;
atomic_inc(&cur_trans->use_count);
ret = 0;
break;
}
if (t->transid > transid)
if (t->transid > transid) {
ret = 0;
break;
}
}
spin_unlock(&root->fs_info->trans_lock);
ret = -EINVAL;
/* The specified transaction doesn't exist */
if (!cur_trans)
goto out; /* bad transid */
goto out;
} else {
/* find newest transaction that is committing | committed */
spin_lock(&root->fs_info->trans_lock);
Expand All @@ -497,9 +500,7 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid)
}

wait_for_commit(root, cur_trans);

put_transaction(cur_trans);
ret = 0;
out:
return ret;
}
Expand Down

0 comments on commit 4ac8c24

Please sign in to comment.