]> git.hungrycats.org Git - linux/commit
btrfs: only use ->max_extent_size if it is set in the bitmap
authorJosef Bacik <josef@toxicpanda.com>
Thu, 18 Nov 2021 21:33:14 +0000 (16:33 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 28 Nov 2021 02:53:24 +0000 (21:53 -0500)
commitb1f94e976cbaae6a216d2140aee2545edcc74ca2
tree346dc58f466c952e306b4064f069e17d91d3b58d
parent2dcd612d3d0d0562762f66b9b0a7a5cd32338baa
btrfs: only use ->max_extent_size if it is set in the bitmap

While adding self tests for my space index change I was hitting a
problem where the space indexed tree wasn't returning the expected
->max_extent_size.  This is because we will skip searching any entry
that doesn't have ->bytes >= the amount of bytes we want.  However we'll
still set the max_extent_size based on that entry.  The problem is if we
don't search the bitmap we won't have ->max_extent_size set properly, so
we can't really trust it.

This doesn't really result in a problem per-se, it can just result in us
not finding contiguous area that may exist.  Fix the max_extent_size
helper to return ->bytes if ->max_extent_size isn't set, and add a big
comment explaining why we're doing this.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
(cherry picked from commit f6f99b1a6babb6db7e98f00b526a858fbb2e277e)
fs/btrfs/free-space-cache.c