[PATCH 4.19 340/361] btrfs: reset max_extent_size on clear in a bitmap

From: Greg Kroah-Hartman
Date: Sun Nov 11 2018 - 18:48:03 EST


4.19-stable review patch. If anyone has any objections, please let me know.

------------------

From: Josef Bacik <jbacik@xxxxxx>

commit 553cceb49681d60975d00892877d4c871bf220f9 upstream.

We need to clear the max_extent_size when we clear bits from a bitmap
since it could have been from the range that contains the
max_extent_size.

CC: stable@xxxxxxxxxxxxxxx # 4.4+
Reviewed-by: Liu Bo <bo.liu@xxxxxxxxxxxxxxxxx>
Signed-off-by: Josef Bacik <jbacik@xxxxxx>
Signed-off-by: David Sterba <dsterba@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
fs/btrfs/free-space-cache.c | 2 ++
1 file changed, 2 insertions(+)

--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1687,6 +1687,8 @@ static inline void __bitmap_clear_bits(s
bitmap_clear(info->bitmap, start, count);

info->bytes -= bytes;
+ if (info->max_extent_size > ctl->unit)
+ info->max_extent_size = 0;
}

static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,