Revert "Btrfs: rework the overcommit logic to be based on the total size"
This reverts commit 70afa3998c
. 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>
This commit is contained in:
@@ -3925,7 +3925,6 @@ static int can_overcommit(struct btrfs_root *root,
|
|||||||
u64 space_size;
|
u64 space_size;
|
||||||
u64 avail;
|
u64 avail;
|
||||||
u64 used;
|
u64 used;
|
||||||
u64 to_add;
|
|
||||||
|
|
||||||
used = space_info->bytes_used + space_info->bytes_reserved +
|
used = space_info->bytes_used + space_info->bytes_reserved +
|
||||||
space_info->bytes_pinned + space_info->bytes_readonly;
|
space_info->bytes_pinned + space_info->bytes_readonly;
|
||||||
@@ -3959,25 +3958,17 @@ static int can_overcommit(struct btrfs_root *root,
|
|||||||
BTRFS_BLOCK_GROUP_RAID10))
|
BTRFS_BLOCK_GROUP_RAID10))
|
||||||
avail >>= 1;
|
avail >>= 1;
|
||||||
|
|
||||||
to_add = space_info->total_bytes;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we aren't flushing all things, let us overcommit up to
|
* If we aren't flushing all things, let us overcommit up to
|
||||||
* 1/2th of the space. If we can flush, don't let us overcommit
|
* 1/2th of the space. If we can flush, don't let us overcommit
|
||||||
* too much, let it overcommit up to 1/8 of the space.
|
* too much, let it overcommit up to 1/8 of the space.
|
||||||
*/
|
*/
|
||||||
if (flush == BTRFS_RESERVE_FLUSH_ALL)
|
if (flush == BTRFS_RESERVE_FLUSH_ALL)
|
||||||
to_add >>= 3;
|
avail >>= 3;
|
||||||
else
|
else
|
||||||
to_add >>= 1;
|
avail >>= 1;
|
||||||
|
|
||||||
/*
|
if (used + bytes < space_info->total_bytes + avail)
|
||||||
* Limit the overcommit to the amount of free space we could possibly
|
|
||||||
* allocate for chunks.
|
|
||||||
*/
|
|
||||||
to_add = min(avail, to_add);
|
|
||||||
|
|
||||||
if (used + bytes < space_info->total_bytes + to_add)
|
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user