diff options
author | Dennis Zhou <dennis@kernel.org> | 2020-01-02 16:26:41 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-01-20 16:41:00 +0100 |
commit | 9ddf648f9c2a492cef4e41e31c50515a817d0562 (patch) | |
tree | 64ecae153d63e8392660d0e73e5d99391010795b /fs/btrfs/discard.c | |
parent | 5cb0724e1b4653629c508906ca6098bae77d2f95 (diff) | |
download | linux-9ddf648f9c2a492cef4e41e31c50515a817d0562.tar.gz linux-9ddf648f9c2a492cef4e41e31c50515a817d0562.tar.bz2 linux-9ddf648f9c2a492cef4e41e31c50515a817d0562.zip |
btrfs: keep track of discard reuse stats
Keep track of how much we are discarding and how often we are reusing
with async discard. The discard_*_bytes values don't need any special
protection because the work item provides the single threaded access.
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.c')
-rw-r--r-- | fs/btrfs/discard.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/discard.c b/fs/btrfs/discard.c index 5af42e0317b7..40dcb5dcdc95 100644 --- a/fs/btrfs/discard.c +++ b/fs/btrfs/discard.c @@ -417,11 +417,13 @@ static void btrfs_discard_workfn(struct work_struct *work) block_group->discard_cursor, btrfs_block_group_end(block_group), minlen, maxlen, true); + discard_ctl->discard_bitmap_bytes += trimmed; } else { btrfs_trim_block_group_extents(block_group, &trimmed, block_group->discard_cursor, btrfs_block_group_end(block_group), minlen, true); + discard_ctl->discard_extent_bytes += trimmed; } discard_ctl->prev_discard = trimmed; @@ -626,6 +628,9 @@ void btrfs_discard_init(struct btrfs_fs_info *fs_info) discard_ctl->delay = BTRFS_DISCARD_MAX_DELAY_MSEC; discard_ctl->iops_limit = BTRFS_DISCARD_MAX_IOPS; discard_ctl->kbps_limit = 0; + discard_ctl->discard_extent_bytes = 0; + discard_ctl->discard_bitmap_bytes = 0; + atomic64_set(&discard_ctl->discard_bytes_saved, 0); } void btrfs_discard_cleanup(struct btrfs_fs_info *fs_info) |