btrfs: restructure find_free_dev_extent()
PATCH v3 4/6 btrfs: restructure find_free_dev_extent()
- make it return the start position and length of the max free space when it can not find a suitable free space.
- make it more readability
Signed-off-by Miao Xie <[email protected]>
--- fs/btrfs/extent-tree.c | 4 +- fs/btrfs/volumes.c | 155 +++++++++++++++++++++++++++-------------------- 2 files changed, 91 insertions(+), 68 deletions(-)
fs/btrfs/extent-tree.c +2 -2
@@ -8098,7 +8098,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)mutex_lock (&root->fs_info->chunk_mutex);list_for_each_entry (device, &fs_devices->alloc_list, dev_alloc_list) {u64 min_free =btrfs_block_group_used (&block_group->item); -u64 dev_offset, max_avail; +u64 dev_offset;/* * check to make sure we can actually find a chunk with enough
@@ -8106,7 +8106,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)*/ if (device->total_bytes > device->bytes_used + min_free) { ret =find_free_dev_extent (NULL , device, min_free, - &dev_offset, &max_avail); + &dev_offset,NULL );if (!ret)break ; ret =-1 ;
fs/btrfs/volumes.c +89 -66
219 lines not on this page · raw message
Signature · 1 line
1.7.2.3