btrfs: reset max_extent_size properly
authorJosef Bacik <josef@toxicpanda.com>
Thu, 11 Oct 2018 19:54:03 +0000 (15:54 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:58 +0000 (11:08 -0800)
commite982beca3e4e989716dda88d215d1b96b585e542
tree81b847cd77db1ac20803b38b172412f746d87d29
parentea9c846f54dbf03da159a1b7566aa95e9bf1674b
btrfs: reset max_extent_size properly

commit 21a94f7acf0f748599ea552af5d9ee7d7e41c72f upstream.

If we use up our block group before allocating a new one we'll easily
get a max_extent_size that's set really really low, which will result in
a lot of fragmentation.  We need to make sure we're resetting the
max_extent_size when we add a new chunk or add new space.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent-tree.c