aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
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:
893 return ret; 893 return ret;
894} 894}
895 895
896int btrfs_cross_ref_exists(struct btrfs_root *root, 896int btrfs_cross_ref_exists(struct btrfs_trans_handle *trans,
897 struct btrfs_root *root,
897 struct btrfs_key *key, u64 bytenr) 898 struct btrfs_key *key, u64 bytenr)
898{ 899{
899 struct btrfs_trans_handle *trans;
900 struct btrfs_root *old_root; 900 struct btrfs_root *old_root;
901 struct btrfs_path *path = NULL; 901 struct btrfs_path *path = NULL;
902 struct extent_buffer *eb; 902 struct extent_buffer *eb;
@@ -908,6 +908,7 @@ int btrfs_cross_ref_exists(struct btrfs_root *root,
908 int level; 908 int level;
909 int ret; 909 int ret;
910 910
911 BUG_ON(trans == NULL);
911 BUG_ON(key->type != BTRFS_EXTENT_DATA_KEY); 912 BUG_ON(key->type != BTRFS_EXTENT_DATA_KEY);
912 ret = get_reference_status(root, bytenr, 0, key->objectid, 913 ret = get_reference_status(root, bytenr, 0, key->objectid,
913 &min_generation, &ref_count); 914 &min_generation, &ref_count);
@@ -917,7 +918,6 @@ int btrfs_cross_ref_exists(struct btrfs_root *root,
917 if (ref_count != 1) 918 if (ref_count != 1)
918 return 1; 919 return 1;
919 920
920 trans = btrfs_start_transaction(root, 0);
921 old_root = root->dirty_root->root; 921 old_root = root->dirty_root->root;
922 ref_generation = old_root->root_key.offset; 922 ref_generation = old_root->root_key.offset;
923 923
@@ -973,7 +973,6 @@ int btrfs_cross_ref_exists(struct btrfs_root *root,
973out: 973out:
974 if (path) 974 if (path)
975 btrfs_free_path(path); 975 btrfs_free_path(path);
976 btrfs_end_transaction(trans, root);
977 return ret; 976 return ret;
978} 977}
979 978
@@ -3320,7 +3319,7 @@ again:
3320 mutex_unlock(&root->fs_info->alloc_mutex); 3319 mutex_unlock(&root->fs_info->alloc_mutex);
3321 3320
3322 btrfs_start_delalloc_inodes(root); 3321 btrfs_start_delalloc_inodes(root);
3323 btrfs_wait_ordered_extents(tree_root); 3322 btrfs_wait_ordered_extents(tree_root, 0);
3324 3323
3325 mutex_lock(&root->fs_info->alloc_mutex); 3324 mutex_lock(&root->fs_info->alloc_mutex);
3326 3325
@@ -3407,7 +3406,7 @@ next:
3407 btrfs_clean_old_snapshots(tree_root); 3406 btrfs_clean_old_snapshots(tree_root);
3408 3407
3409 btrfs_start_delalloc_inodes(root); 3408 btrfs_start_delalloc_inodes(root);
3410 btrfs_wait_ordered_extents(tree_root); 3409 btrfs_wait_ordered_extents(tree_root, 0);
3411 3410
3412 trans = btrfs_start_transaction(tree_root, 1); 3411 trans = btrfs_start_transaction(tree_root, 1);
3413 btrfs_commit_transaction(trans, tree_root); 3412 btrfs_commit_transaction(trans, tree_root);