aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-09-17 10:48:00 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-21 11:05:26 -0400
commit14575aef4212d2cc02274bf1f5456f3e644f03f8 (patch)
tree307c98acb8ba3070f21e712361f638863d535665 /fs/btrfs
parent652f25a2921eb32a3e6f88aed3c59b494c1287c4 (diff)
Revert "Btrfs: rework the overcommit logic to be based on the total size"
This reverts commit 70afa3998c9baed4186df38988246de1abdab56d. It is causing performance issues and wasn't actually correct. There were problems with the way we flushed delalloc and that was the real cause of the early enospc. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent-tree.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 2f03181b777f..07f7f6942128 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3925,7 +3925,6 @@ static int can_overcommit(struct btrfs_root *root,
3925 u64 space_size; 3925 u64 space_size;
3926 u64 avail; 3926 u64 avail;
3927 u64 used; 3927 u64 used;
3928 u64 to_add;
3929 3928
3930 used = space_info->bytes_used + space_info->bytes_reserved + 3929 used = space_info->bytes_used + space_info->bytes_reserved +
3931 space_info->bytes_pinned + space_info->bytes_readonly; 3930 space_info->bytes_pinned + space_info->bytes_readonly;
@@ -3959,25 +3958,17 @@ static int can_overcommit(struct btrfs_root *root,
3959 BTRFS_BLOCK_GROUP_RAID10)) 3958 BTRFS_BLOCK_GROUP_RAID10))
3960 avail >>= 1; 3959 avail >>= 1;
3961 3960
3962 to_add = space_info->total_bytes;
3963
3964 /* 3961 /*
3965 * If we aren't flushing all things, let us overcommit up to 3962 * If we aren't flushing all things, let us overcommit up to
3966 * 1/2th of the space. If we can flush, don't let us overcommit 3963 * 1/2th of the space. If we can flush, don't let us overcommit
3967 * too much, let it overcommit up to 1/8 of the space. 3964 * too much, let it overcommit up to 1/8 of the space.
3968 */ 3965 */
3969 if (flush == BTRFS_RESERVE_FLUSH_ALL) 3966 if (flush == BTRFS_RESERVE_FLUSH_ALL)
3970 to_add >>= 3; 3967 avail >>= 3;
3971 else 3968 else
3972 to_add >>= 1; 3969 avail >>= 1;
3973
3974 /*
3975 * Limit the overcommit to the amount of free space we could possibly
3976 * allocate for chunks.
3977 */
3978 to_add = min(avail, to_add);
3979 3970
3980 if (used + bytes < space_info->total_bytes + to_add) 3971 if (used + bytes < space_info->total_bytes + avail)
3981 return 1; 3972 return 1;
3982 return 0; 3973 return 0;
3983} 3974}