aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-08-05 13:05:02 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:06 -0400
commit7ea394f1192bee1af67ea4762c88ef4b7b0487a8 (patch)
treee2c593d054d802bc71e86508a5b7523ff80cc1ea /fs/btrfs/transaction.c
parent00e4e6b33a0f78aab4b788d6d31c884fd8bf88da (diff)
Btrfs: Fix nodatacow for the new data=ordered mode
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index ebf5362da1d2..9d3d08e9f8d1 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -438,6 +438,7 @@ static noinline int add_dirty_roots(struct btrfs_trans_handle *trans,
438 438
439 free_extent_buffer(root->commit_root); 439 free_extent_buffer(root->commit_root);
440 root->commit_root = NULL; 440 root->commit_root = NULL;
441 root->dirty_root = NULL;
441 442
442 spin_lock(&root->list_lock); 443 spin_lock(&root->list_lock);
443 list_del_init(&dirty->root->dead_list); 444 list_del_init(&dirty->root->dead_list);
@@ -461,6 +462,7 @@ static noinline int add_dirty_roots(struct btrfs_trans_handle *trans,
461 sizeof(struct btrfs_disk_key)); 462 sizeof(struct btrfs_disk_key));
462 root->root_item.drop_level = 0; 463 root->root_item.drop_level = 0;
463 root->commit_root = NULL; 464 root->commit_root = NULL;
465 root->dirty_root = NULL;
464 root->root_key.offset = root->fs_info->generation; 466 root->root_key.offset = root->fs_info->generation;
465 btrfs_set_root_bytenr(&root->root_item, 467 btrfs_set_root_bytenr(&root->root_item,
466 root->node->start); 468 root->node->start);
@@ -762,7 +764,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
762 } 764 }
763 765
764 do { 766 do {
767 int snap_pending = 0;
765 joined = cur_trans->num_joined; 768 joined = cur_trans->num_joined;
769 if (!list_empty(&trans->transaction->pending_snapshots))
770 snap_pending = 1;
771
766 WARN_ON(cur_trans != trans->transaction); 772 WARN_ON(cur_trans != trans->transaction);
767 prepare_to_wait(&cur_trans->writer_wait, &wait, 773 prepare_to_wait(&cur_trans->writer_wait, &wait,
768 TASK_UNINTERRUPTIBLE); 774 TASK_UNINTERRUPTIBLE);
@@ -774,6 +780,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
774 780
775 mutex_unlock(&root->fs_info->trans_mutex); 781 mutex_unlock(&root->fs_info->trans_mutex);
776 782
783 if (snap_pending) {
784 ret = btrfs_wait_ordered_extents(root, 1);
785 BUG_ON(ret);
786 }
787
777 schedule_timeout(timeout); 788 schedule_timeout(timeout);
778 789
779 mutex_lock(&root->fs_info->trans_mutex); 790 mutex_lock(&root->fs_info->trans_mutex);