aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-08-04 23:17:27 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:06 -0400
commitea8c281947950fac5f78818b767821d696c9512a (patch)
treea30e9da5371d9a694a8f73d450231107ccad1dcb /fs/btrfs/extent-tree.c
parentd7a029a89ef370e74b63f18b81498d90d1ee3cc1 (diff)
Btrfs: Maintain a list of inodes that are delalloc and a way to wait on them
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index dbde12881244..33cb2ac4cb28 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1230,7 +1230,6 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
1230 found->total_bytes += total_bytes; 1230 found->total_bytes += total_bytes;
1231 found->bytes_used += bytes_used; 1231 found->bytes_used += bytes_used;
1232 found->full = 0; 1232 found->full = 0;
1233 WARN_ON(found->total_bytes < found->bytes_used);
1234 *space_info = found; 1233 *space_info = found;
1235 return 0; 1234 return 0;
1236 } 1235 }
@@ -2841,8 +2840,7 @@ again:
2841 */ 2840 */
2842 clear_page_dirty_for_io(page); 2841 clear_page_dirty_for_io(page);
2843 2842
2844 set_extent_delalloc(io_tree, page_start, 2843 btrfs_set_extent_delalloc(inode, page_start, page_end);
2845 page_end, GFP_NOFS);
2846 set_page_dirty(page); 2844 set_page_dirty(page);
2847 2845
2848 unlock_extent(io_tree, page_start, page_end, GFP_NOFS); 2846 unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
@@ -3319,6 +3317,13 @@ again:
3319 key.type = 0; 3317 key.type = 0;
3320 cur_byte = key.objectid; 3318 cur_byte = key.objectid;
3321 3319
3320 mutex_unlock(&root->fs_info->alloc_mutex);
3321
3322 btrfs_start_delalloc_inodes(root);
3323 btrfs_wait_ordered_extents(tree_root);
3324
3325 mutex_lock(&root->fs_info->alloc_mutex);
3326
3322 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 3327 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
3323 if (ret < 0) 3328 if (ret < 0)
3324 goto out; 3329 goto out;
@@ -3401,6 +3406,7 @@ next:
3401 3406
3402 btrfs_clean_old_snapshots(tree_root); 3407 btrfs_clean_old_snapshots(tree_root);
3403 3408
3409 btrfs_start_delalloc_inodes(root);
3404 btrfs_wait_ordered_extents(tree_root); 3410 btrfs_wait_ordered_extents(tree_root);
3405 3411
3406 trans = btrfs_start_transaction(tree_root, 1); 3412 trans = btrfs_start_transaction(tree_root, 1);