summaryrefslogtreecommitdiff
path: root/fs/btrfs/discard.h
diff options
context:
space:
mode:
authorDennis Zhou <dennis@kernel.org>2020-01-02 16:26:39 -0500
committerDavid Sterba <dsterba@suse.com>2020-01-20 16:41:00 +0100
commit7fe6d45e4009d9502fef32ac6222862ac17f8674 (patch)
tree870db67c211f8be19b54e97ae253f6600c846af5 /fs/btrfs/discard.h
parent19b2a2c71979f849cadc33af3577f739cc95e1f0 (diff)
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>
Diffstat (limited to 'fs/btrfs/discard.h')
-rw-r--r--fs/btrfs/discard.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/discard.h b/fs/btrfs/discard.h
index f9445ee5dcc3..21a15776dac4 100644
--- a/fs/btrfs/discard.h
+++ b/fs/btrfs/discard.h
@@ -11,6 +11,11 @@ struct btrfs_block_group;
/* Discard size limits */
#define BTRFS_ASYNC_DISCARD_DEFAULT_MAX_SIZE (SZ_64M)
+#define BTRFS_ASYNC_DISCARD_MAX_FILTER (SZ_1M)
+#define BTRFS_ASYNC_DISCARD_MIN_FILTER (SZ_32K)
+
+/* List operations */
+void btrfs_discard_check_filter(struct btrfs_block_group *block_group, u64 bytes);
/* Work operations */
void btrfs_discard_cancel_work(struct btrfs_discard_ctl *discard_ctl,