diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-09-09 13:19:42 +0800 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-21 11:05:23 -0400 |
commit | a482039889b85c45fc9616e65d560db7a35d4f54 (patch) | |
tree | 58482aa49aa50c30cdd2e7b496f30dd1c11ac860 /fs/attr.c | |
parent | 13fd8da98f79317d26277360d510caa1edf9bab3 (diff) | |
download | linux-a482039889b85c45fc9616e65d560db7a35d4f54.tar.bz2 |
Btrfs: allocate the free space by the existed max extent size when ENOSPC
By the current code, if the requested size is very large, and all the extents
in the free space cache are small, we will waste lots of the cpu time to cut
the requested size in half and search the cache again and again until it gets
down to the size the allocator can return. In fact, we can know the max extent
size in the cache after the first search, so we needn't cut the size in half
repeatedly, and just use the max extent size directly. This way can save
lots of cpu time and make the performance grow up when there are only fragments
in the free space cache.
According to my test, if there are only 4KB free space extents in the fs,
and the total size of those extents are 256MB, we can reduce the execute
time of the following test from 5.4s to 1.4s.
dd if=/dev/zero of=<testfile> bs=1MB count=1 oflag=sync
Changelog v2 -> v3:
- fix the problem that we skip the block group with the space which is
less than we need.
Changelog v1 -> v2:
- address the problem that we return a wrong start position when searching
the free space in a bitmap.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/attr.c')
0 files changed, 0 insertions, 0 deletions