]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
btrfs: Refactor find_free_extent loops update into find_free_extent_update_loop
authorQu Wenruo <wqu@suse.com>
Fri, 2 Nov 2018 01:39:50 +0000 (09:39 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:26 +0000 (14:51 +0100)
commite72d79d6bcee564dbdf83169c743bbd3f8438108
tree7bfe529dfee696265e9fab344bb2d61a8b12fc09
parente1a4184815672c0cd8ea91beca3dd6d0bd4b9e53
btrfs: Refactor find_free_extent loops update into find_free_extent_update_loop

We have a complex loop design for find_free_extent(), that has different
behavior for each loop, some even includes new chunk allocation.

Instead of putting such a long code into find_free_extent() and makes it
harder to read, just extract them into find_free_extent_update_loop().

With all the cleanups, the main find_free_extent() should be pretty
barebone:

find_free_extent()
|- Iterate through all block groups
|  |- Get a valid block group
|  |- Try to do clustered allocation in that block group
|  |- Try to do unclustered allocation in that block group
|  |- Check if the result is valid
|  |  |- If valid, then exit
|  |- Jump to next block group
|
|- Push harder to find free extents
   |- If not found, re-iterate all block groups

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
[ copy callchain from changelog to function comment ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c