btrfs: Refactor clustered extent allocation into find_free_extent_clustered
authorQu Wenruo <wqu@suse.com>
Fri, 2 Nov 2018 01:39:48 +0000 (09:39 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:26 +0000 (14:51 +0100)
commitd06e3bb69009d21802776b8751dfe5deef7102f5
tree96c78273990af3cf0b007723c6c6afad72c02879
parentb4bd745d1230ddcf8de408997db9a45cd696508d
btrfs: Refactor clustered extent allocation into find_free_extent_clustered

We have two main methods to find free extents inside a block group:

1) clustered allocation
2) unclustered allocation

This patch will extract the clustered allocation into
find_free_extent_clustered() to make it a little easier to read.

Instead of jumping between different labels in find_free_extent(), the
helper function will use return value to indicate different behavior.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c