Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 168547
b: refs/heads/master
c: 249ac1e
h: refs/heads/master
i:
  168545: 69c7b76
  168543: 00505fd
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Nov 11, 2009
1 parent 8fa8305 commit 2d015c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 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: 6346c93988caa3048bf4d81f9ba3608a7a195aa2
refs/heads/master: 249ac1e55c642c670f47aacdc57629bbbf10a8db
19 changes: 13 additions & 6 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,23 @@ static void wait_current_trans(struct btrfs_root *root)
}
}

enum btrfs_trans_type {
TRANS_START,
TRANS_JOIN,
TRANS_USERSPACE,
};

static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,
int num_blocks, int wait)
int num_blocks, int type)
{
struct btrfs_trans_handle *h =
kmem_cache_alloc(btrfs_trans_handle_cachep, GFP_NOFS);
int ret;

mutex_lock(&root->fs_info->trans_mutex);
if (!root->fs_info->log_root_recovering &&
((wait == 1 && !root->fs_info->open_ioctl_trans) || wait == 2))
((type == TRANS_START && !root->fs_info->open_ioctl_trans) ||
type == TRANS_USERSPACE))
wait_current_trans(root);
ret = join_transaction(root);
BUG_ON(ret);
Expand All @@ -186,7 +193,7 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,
h->alloc_exclude_start = 0;
h->delayed_ref_updates = 0;

if (!current->journal_info)
if (!current->journal_info && type != TRANS_USERSPACE)
current->journal_info = h;

root->fs_info->running_transaction->use_count++;
Expand All @@ -198,18 +205,18 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,
struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
int num_blocks)
{
return start_transaction(root, num_blocks, 1);
return start_transaction(root, num_blocks, TRANS_START);
}
struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root,
int num_blocks)
{
return start_transaction(root, num_blocks, 0);
return start_transaction(root, num_blocks, TRANS_JOIN);
}

struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *r,
int num_blocks)
{
return start_transaction(r, num_blocks, 2);
return start_transaction(r, num_blocks, TRANS_USERSPACE);
}

/* wait for a transaction commit to be fully complete */
Expand Down

0 comments on commit 2d015c9

Please sign in to comment.