btrfs: have multiple discard lists
authorDennis Zhou <dennis@kernel.org>
Thu, 2 Jan 2020 21:26:39 +0000 (16:26 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Jan 2020 15:41:00 +0000 (16:41 +0100)
commit7fe6d45e4009d9502fef32ac6222862ac17f8674
tree870db67c211f8be19b54e97ae253f6600c846af5
parent19b2a2c71979f849cadc33af3577f739cc95e1f0
btrfs: have multiple discard lists

Non-block group destruction discarding currently only had a single list
with no minimum discard length. This can lead to caravaning more
meaningful discards behind a heavily fragmented block group.

This adds support for multiple lists with minimum discard lengths to
prevent the caravan effect. We promote block groups back up when we
exceed the BTRFS_ASYNC_DISCARD_MAX_FILTER size, currently we support
only 2 lists with filters of 1MB and 32KB respectively.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/discard.c
fs/btrfs/discard.h
fs/btrfs/free-space-cache.c
fs/btrfs/free-space-cache.h