]> git.karo-electronics.de Git - mv-sheeva.git/commit
btrfs: make the chunk allocator utilize the devices better
authorMiao Xie <miaox@cn.fujitsu.com>
Wed, 5 Jan 2011 10:07:28 +0000 (10:07 +0000)
committerChris Mason <chris.mason@oracle.com>
Sun, 16 Jan 2011 16:30:19 +0000 (11:30 -0500)
commitb2117a39fa96cf4814e7cab8c11494149ba6f29d
tree9327d1332d68f91931767ee7bc6233251ab41565
parent7bfc837df935d850fe996dfe92ef48975cd4170a
btrfs: make the chunk allocator utilize the devices better

With this patch, we change the handling method when we can not get enough free
extents with default size.

Implementation:
1. Look up the suitable free extent on each device and keep the search result.
   If not find a suitable free extent, keep the max free extent
2. If we get enough suitable free extents with default size, chunk allocation
   succeeds.
3. If we can not get enough free extents, but the number of the extent with
   default size is >= min_stripes, we just change the mapping information
   (reduce the number of stripes in the extent map), and chunk allocation
   succeeds.
4. If the number of the extent with default size is < min_stripes, sort the
   devices by its max free extent's size descending
5. Use the size of the max free extent on the (num_stripes - 1)th device as the
   stripe size to allocate the device space

By this way, the chunk allocator can allocate chunks as large as possible when
the devices' space is not enough and make full use of the devices.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c
fs/btrfs/volumes.h