aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2012-09-06 16:47:00 -0400
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:19:15 -0400
commitdea31f52337c18f19eadfbbccb0c477942dad495 (patch)
tree1088f1de2b69f6d8af1de1c57a40de64b6872d31
parent9e8a4a8b0b9484e8d14674fc62c9ad8ac9dbce5b (diff)
Btrfs: wait on async pages when shrinking delalloc
Mitch reported a problem where you could get an ENOSPC error when untarring a kernel git tree onto a 16gb file system with compress-force=zlib. This is because compression is a huge pain, it will return from ->writepages() without having actually created any ordered extents. To get around this we check to see if the async submit counter is up, and if it is wait until it drops to 0 before doing our normal ordered wait dance. With this patch I can now untar a kernel git tree onto a 16gb file system without getting ENOSPC errors. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r--fs/btrfs/extent-tree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b6b33e463ac3..06369d588f27 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3697,6 +3697,13 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
3697 writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages, 3697 writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages,
3698 WB_REASON_FS_FREE_SPACE); 3698 WB_REASON_FS_FREE_SPACE);
3699 3699
3700 /*
3701 * We need to wait for the async pages to actually start before
3702 * we do anything.
3703 */
3704 wait_event(root->fs_info->async_submit_wait,
3705 !atomic_read(&root->fs_info->async_delalloc_pages));
3706
3700 spin_lock(&space_info->lock); 3707 spin_lock(&space_info->lock);
3701 if (space_info->bytes_used + space_info->bytes_reserved + 3708 if (space_info->bytes_used + space_info->bytes_reserved +
3702 space_info->bytes_pinned + space_info->bytes_readonly + 3709 space_info->bytes_pinned + space_info->bytes_readonly +