]> git.hungrycats.org Git - linux/commitdiff
Btrfs: don't loop in allocator for space cache
authorJosef Bacik <jbacik@fb.com>
Fri, 25 Sep 2015 20:13:11 +0000 (16:13 -0400)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Wed, 28 Oct 2015 01:11:46 +0000 (21:11 -0400)
The space cache needs to have contiguous allocations, and the allocator tries to
make allocations by reducing the amount of bytes requested and re-searching.
But this just makes us waste time when we are very fragmented, so if we can't
find our space just exit, don't bother trying to search again.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
(cherry picked from commit 52cb78ecb1d06958feccbc5894f0a42e8f0050a4)
(cherry picked from commit c6a1d02222da81732aff1cddb64558388307e165)

fs/btrfs/extent-tree.c

index 9761a07ac16c5cf8267cb01497ef4a764ecf1ae8..9e55b0993a8739b5d0c58562169f68d917dfdc86 100644 (file)
@@ -7267,7 +7267,7 @@ int btrfs_reserve_extent(struct btrfs_root *root,
                         u64 empty_size, u64 hint_byte,
                         struct btrfs_key *ins, int is_data, int delalloc)
 {
-       bool final_tried = false;
+       bool final_tried = num_bytes == min_alloc_size;
        u64 flags;
        int ret;