aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-23 10:01:08 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-23 10:01:08 -0400
commitd571976292839cec05a2820b08f7629b145ed157 (patch)
tree6a3f2f5a9b9c70f61d00ac10edaaaa60d5043474 /fs/btrfs/transaction.c
parent79154b1b5bcf87903db7ff16a30b360b78d6fe4f (diff)
btrfs_create, btrfs_write_super, btrfs_sync_fs
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 8dc1c170f10f..4903b47c9780 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -25,7 +25,7 @@ static int join_transaction(struct btrfs_root *root)
25 init_waitqueue_head(&cur_trans->writer_wait); 25 init_waitqueue_head(&cur_trans->writer_wait);
26 init_waitqueue_head(&cur_trans->commit_wait); 26 init_waitqueue_head(&cur_trans->commit_wait);
27 cur_trans->in_commit = 0; 27 cur_trans->in_commit = 0;
28 cur_trans->use_count = 0; 28 cur_trans->use_count = 1;
29 cur_trans->commit_done = 0; 29 cur_trans->commit_done = 0;
30 } 30 }
31 cur_trans->num_writers++; 31 cur_trans->num_writers++;
@@ -56,7 +56,7 @@ int btrfs_end_transaction(struct btrfs_trans_handle *trans,
56 struct btrfs_transaction *cur_trans; 56 struct btrfs_transaction *cur_trans;
57 mutex_lock(&root->fs_info->trans_mutex); 57 mutex_lock(&root->fs_info->trans_mutex);
58 cur_trans = root->fs_info->running_transaction; 58 cur_trans = root->fs_info->running_transaction;
59 WARN_ON(cur_trans->num_writers <= 1); 59 WARN_ON(cur_trans->num_writers < 1);
60 if (waitqueue_active(&cur_trans->writer_wait)) 60 if (waitqueue_active(&cur_trans->writer_wait))
61 wake_up(&cur_trans->writer_wait); 61 wake_up(&cur_trans->writer_wait);
62 cur_trans->num_writers--; 62 cur_trans->num_writers--;
@@ -155,10 +155,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
155 155
156 cur_trans = root->fs_info->running_transaction; 156 cur_trans = root->fs_info->running_transaction;
157 root->fs_info->running_transaction = NULL; 157 root->fs_info->running_transaction = NULL;
158 mutex_unlock(&root->fs_info->trans_mutex);
159 158
160 memcpy(&snap_key, &root->root_key, sizeof(snap_key)); 159 if (root->node != root->commit_root) {
161 root->root_key.offset++; 160 memcpy(&snap_key, &root->root_key, sizeof(snap_key));
161 root->root_key.offset++;
162 }
163
164 mutex_unlock(&root->fs_info->trans_mutex);
162 165
163 if (btrfs_root_blocknr(&root->root_item) != root->node->b_blocknr) { 166 if (btrfs_root_blocknr(&root->root_item) != root->node->b_blocknr) {
164 btrfs_set_root_blocknr(&root->root_item, root->node->b_blocknr); 167 btrfs_set_root_blocknr(&root->root_item, root->node->b_blocknr);