btrfs: limit max discard size for async discard
authorDennis Zhou <dennis@kernel.org>
Thu, 2 Jan 2020 21:26:37 +0000 (16:26 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Jan 2020 15:40:59 +0000 (16:40 +0100)
commit4aa9ad520398bf9cef70fc9c363567da44312045
tree77badf26527c9d58896c8d14f3f906109aff668d
parente93591bb6ecf3e31c8f5366eac143f4f9c270915
btrfs: limit max discard size for async discard

Throttle the maximum size of a discard so that we can provide an upper
bound for the rate of async discard. While the block layer is able to
split discards into the appropriate sized discards, we want to be able
to account more accurately the rate at which we are consuming NCQ slots
as well as limit the upper bound of work for a discard.

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/discard.h
fs/btrfs/free-space-cache.c