summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-08-05 19:05:02 +0200
committerChris Mason <chris.mason@oracle.com>2008-09-25 17:04:06 +0200
commit7ea394f1192bee1af67ea4762c88ef4b7b0487a8 (patch)
treee2c593d054d802bc71e86508a5b7523ff80cc1ea /fs/btrfs/extent-tree.c
parentGet rid of BTRFS_I(inode)->index and use local vars instead (diff)
downloadlinux-7ea394f1192bee1af67ea4762c88ef4b7b0487a8.tar.xz
linux-7ea394f1192bee1af67ea4762c88ef4b7b0487a8.zip
Btrfs: Fix nodatacow for the new data=ordered mode
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 33cb2ac4cb28..fff219ed61d9 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -893,10 +893,10 @@ out:
return ret;
}
-int btrfs_cross_ref_exists(struct btrfs_root *root,
+int btrfs_cross_ref_exists(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
struct btrfs_key *key, u64 bytenr)
{
- struct btrfs_trans_handle *trans;
struct btrfs_root *old_root;
struct btrfs_path *path = NULL;
struct extent_buffer *eb;
@@ -908,6 +908,7 @@ int btrfs_cross_ref_exists(struct btrfs_root *root,
int level;
int ret;
+ BUG_ON(trans == NULL);
BUG_ON(key->type != BTRFS_EXTENT_DATA_KEY);
ret = get_reference_status(root, bytenr, 0, key->objectid,
&min_generation, &ref_count);
@@ -917,7 +918,6 @@ int btrfs_cross_ref_exists(struct btrfs_root *root,
if (ref_count != 1)
return 1;
- trans = btrfs_start_transaction(root, 0);
old_root = root->dirty_root->root;
ref_generation = old_root->root_key.offset;
@@ -973,7 +973,6 @@ int btrfs_cross_ref_exists(struct btrfs_root *root,
out:
if (path)
btrfs_free_path(path);
- btrfs_end_transaction(trans, root);
return ret;
}
@@ -3320,7 +3319,7 @@ again:
mutex_unlock(&root->fs_info->alloc_mutex);
btrfs_start_delalloc_inodes(root);
- btrfs_wait_ordered_extents(tree_root);
+ btrfs_wait_ordered_extents(tree_root, 0);
mutex_lock(&root->fs_info->alloc_mutex);
@@ -3407,7 +3406,7 @@ next:
btrfs_clean_old_snapshots(tree_root);
btrfs_start_delalloc_inodes(root);
- btrfs_wait_ordered_extents(tree_root);
+ btrfs_wait_ordered_extents(tree_root, 0);
trans = btrfs_start_transaction(tree_root, 1);
btrfs_commit_transaction(trans, tree_root);