btrfs: track discardable extents for async discard
The number of discardable extents will serve as the rate limiting metric for how often we should discard. This keeps track of discardable extents in the free space caches by maintaining deltas and propagating them to the global count. The deltas are calculated from 2 values stored in PREV and CURR entries, then propagated up to the global discard ctl. The current counter value becomes the previous counter value after update. Signed-off-by: Dennis Zhou <dennis@kernel.org> Reviewed-by: David Sterba <dsterba@suse.com> [ update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
e4faab844a
commit
dfb79ddb13
@@ -28,6 +28,7 @@ struct btrfs_free_space {
|
||||
unsigned long *bitmap;
|
||||
struct list_head list;
|
||||
enum btrfs_trim_state trim_state;
|
||||
s32 bitmap_extents;
|
||||
};
|
||||
|
||||
static inline bool btrfs_free_space_trimmed(struct btrfs_free_space *info)
|
||||
@@ -50,6 +51,7 @@ struct btrfs_free_space_ctl {
|
||||
int total_bitmaps;
|
||||
int unit;
|
||||
u64 start;
|
||||
s32 discardable_extents[BTRFS_STAT_NR_ENTRIES];
|
||||
const struct btrfs_free_space_op *op;
|
||||
void *private;
|
||||
struct mutex cache_writeout_mutex;
|
||||
|
Reference in New Issue
Block a user