btrfs: add a global per cpu counter to track number of used extent maps
authorFilipe Manana <fdmanana@suse.com>
Fri, 22 Mar 2024 18:02:59 +0000 (18:02 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:06 +0000 (21:31 +0200)
commitf1d97e76915285013037c487d9513ab763005286
tree36d319225332e8670398bfa6aefbadbfc0422102
parent5fa8a6baff817c1b427aa7a8bfc1482043be6d58
btrfs: add a global per cpu counter to track number of used extent maps

Add a per cpu counter that tracks the total number of extent maps that are
in extent trees of inodes that belong to fs trees. This is going to be
used in an upcoming change that adds a shrinker for extent maps. Only
extent maps for fs trees are considered, because for special trees such as
the data relocation tree we don't want to evict their extent maps which
are critical for the relocation to work, and since those are limited, it's
not a concern to have them in memory during the relocation of a block
group. Another case are extent maps for free space cache inodes, which
must always remain in memory, but those are limited (there's only one per
free space cache inode, which means one per block group).

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/extent_map.c
fs/btrfs/fs.h