btrfs: add kbps discard rate limit for async discard

Provide the ability to rate limit based on kbps in addition to iops as
additional guides for the target discard rate. The delay used ends up
being max(kbps_delay, iops_delay).

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Dennis Zhou
2020-01-02 16:26:36 -05:00
committed by David Sterba
parent a230930084
commit e93591bb6e
3 changed files with 54 additions and 2 deletions

View File

@@ -466,10 +466,12 @@ struct btrfs_discard_ctl {
spinlock_t lock;
struct btrfs_block_group *block_group;
struct list_head discard_list[BTRFS_NR_DISCARD_LISTS];
u64 prev_discard;
atomic_t discardable_extents;
atomic64_t discardable_bytes;
unsigned long delay;
u32 iops_limit;
u32 kbps_limit;
};
/* delayed seq elem */