On Wed, Oct 17, 2018 at 02:56:02PM +0800, Qu Wenruo wrote:
> Can be fetched from github:
> https://github.com/adam900710/linux/tree/refactor_find_free_extent
> 
> Which is based on v4.19-rc1.
> 
> extent-tree.c::find_free_extent() could be one of the most
> ill-structured functions, it has at least 6 non-exit tags and jumps
> between them.
> 
> Refactor it into 4 parts:
> 
> 1) find_free_extent()
>    The main entrance, does the main work of block group iteration and
>    block group selection.
>    Now this function doesn't care nor handles free extent search by
>    itself.
> 
> 2) find_free_extent_clustered()
>    Do clustered free extent search.
>    May try to build/re-fill cluster.
> 
> 3) find_free_extent_unclustered()
>    Do unclustered free extent search.
>    May try to fill free space cache.
> 
> 4) find_free_extent_update_loop()
>    Do the loop based black magic.
>    May allocate new chunk.
> 
> With this patch, at least we should make find_free_extent() a little
> easier to read, and provides the basis for later work on this function.
> 
> Current refactor is trying not to touch the original functionality, thus
> the helper structure find_free_extent_ctl still contains a lot of
> unrelated members.
> But it should not change how find_free_extent() works at all.

Thanks, patches added to for-next. It looks much better than before,
more cleanups welcome.

Reply via email to