diff options
author | Dennis Zhou <dennis@kernel.org> | 2020-01-02 22:26:35 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-01-20 16:40:59 +0100 |
commit | a2309300841207de28307ecd2f0e031fccde37a3 (patch) | |
tree | 8f84e7b531380c5330ac456baaedd5956998682d /fs/btrfs/discard.h | |
parent | btrfs: keep track of discardable_bytes for async discard (diff) | |
download | linux-a2309300841207de28307ecd2f0e031fccde37a3.tar.xz linux-a2309300841207de28307ecd2f0e031fccde37a3.zip |
btrfs: calculate discard delay based on number of extents
An earlier patch keeps track of discardable_extents. These are
undiscarded extents managed by the free space cache. Here, we will use
this to dynamically calculate the discard delay interval.
There are 3 rate to consider. The first is the target convergence rate,
the rate to discard all discardable_extents over the
BTRFS_DISCARD_TARGET_MSEC time frame. This is clamped by the lower
limit, the iops limit or BTRFS_DISCARD_MIN_DELAY (1ms), and the upper
limit, BTRFS_DISCARD_MAX_DELAY (1s). We reevaluate this delay every
transaction commit.
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.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/discard.h b/fs/btrfs/discard.h index 0f2f89b1b0b9..5250fe178e49 100644 --- a/fs/btrfs/discard.h +++ b/fs/btrfs/discard.h @@ -17,6 +17,7 @@ void btrfs_discard_schedule_work(struct btrfs_discard_ctl *discard_ctl, bool btrfs_run_discard_work(struct btrfs_discard_ctl *discard_ctl); /* Update operations */ +void btrfs_discard_calc_delay(struct btrfs_discard_ctl *discard_ctl); void btrfs_discard_update_discardable(struct btrfs_block_group *block_group, struct btrfs_free_space_ctl *ctl); |