mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
btrfs: rename extent map shrinker members from struct btrfs_fs_info
The names for the members of struct btrfs_fs_info related to the extent map shrinker are a bit too long, so rename them to be shorter by replacing the "extent_map_" prefix with the "em_" prefix. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
70a5f9e266
commit
e7fa845010
@ -4291,7 +4291,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
|
|||||||
cancel_work_sync(&fs_info->async_reclaim_work);
|
cancel_work_sync(&fs_info->async_reclaim_work);
|
||||||
cancel_work_sync(&fs_info->async_data_reclaim_work);
|
cancel_work_sync(&fs_info->async_data_reclaim_work);
|
||||||
cancel_work_sync(&fs_info->preempt_reclaim_work);
|
cancel_work_sync(&fs_info->preempt_reclaim_work);
|
||||||
cancel_work_sync(&fs_info->extent_map_shrinker_work);
|
cancel_work_sync(&fs_info->em_shrinker_work);
|
||||||
|
|
||||||
/* Cancel or finish ongoing discard work */
|
/* Cancel or finish ongoing discard work */
|
||||||
btrfs_discard_cleanup(fs_info);
|
btrfs_discard_cleanup(fs_info);
|
||||||
|
@ -1212,14 +1212,14 @@ static long btrfs_scan_root(struct btrfs_root *root, struct btrfs_em_shrink_ctx
|
|||||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||||
struct btrfs_inode *inode;
|
struct btrfs_inode *inode;
|
||||||
long nr_dropped = 0;
|
long nr_dropped = 0;
|
||||||
u64 min_ino = fs_info->extent_map_shrinker_last_ino + 1;
|
u64 min_ino = fs_info->em_shrinker_last_ino + 1;
|
||||||
|
|
||||||
inode = btrfs_find_first_inode(root, min_ino);
|
inode = btrfs_find_first_inode(root, min_ino);
|
||||||
while (inode) {
|
while (inode) {
|
||||||
nr_dropped += btrfs_scan_inode(inode, ctx);
|
nr_dropped += btrfs_scan_inode(inode, ctx);
|
||||||
|
|
||||||
min_ino = btrfs_ino(inode) + 1;
|
min_ino = btrfs_ino(inode) + 1;
|
||||||
fs_info->extent_map_shrinker_last_ino = btrfs_ino(inode);
|
fs_info->em_shrinker_last_ino = btrfs_ino(inode);
|
||||||
btrfs_add_delayed_iput(inode);
|
btrfs_add_delayed_iput(inode);
|
||||||
|
|
||||||
if (ctx->scanned >= ctx->nr_to_scan ||
|
if (ctx->scanned >= ctx->nr_to_scan ||
|
||||||
@ -1239,14 +1239,14 @@ static long btrfs_scan_root(struct btrfs_root *root, struct btrfs_em_shrink_ctx
|
|||||||
* inode if there is one or we will find out this was the last
|
* inode if there is one or we will find out this was the last
|
||||||
* one and move to the next root.
|
* one and move to the next root.
|
||||||
*/
|
*/
|
||||||
fs_info->extent_map_shrinker_last_root = btrfs_root_id(root);
|
fs_info->em_shrinker_last_root = btrfs_root_id(root);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* No more inodes in this root, set extent_map_shrinker_last_ino to 0 so
|
* No more inodes in this root, set extent_map_shrinker_last_ino to 0 so
|
||||||
* that when processing the next root we start from its first inode.
|
* that when processing the next root we start from its first inode.
|
||||||
*/
|
*/
|
||||||
fs_info->extent_map_shrinker_last_ino = 0;
|
fs_info->em_shrinker_last_ino = 0;
|
||||||
fs_info->extent_map_shrinker_last_root = btrfs_root_id(root) + 1;
|
fs_info->em_shrinker_last_root = btrfs_root_id(root) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nr_dropped;
|
return nr_dropped;
|
||||||
@ -1261,13 +1261,13 @@ static void btrfs_extent_map_shrinker_worker(struct work_struct *work)
|
|||||||
bool cycled = false;
|
bool cycled = false;
|
||||||
long nr_dropped = 0;
|
long nr_dropped = 0;
|
||||||
|
|
||||||
fs_info = container_of(work, struct btrfs_fs_info, extent_map_shrinker_work);
|
fs_info = container_of(work, struct btrfs_fs_info, em_shrinker_work);
|
||||||
|
|
||||||
ctx.scanned = 0;
|
ctx.scanned = 0;
|
||||||
ctx.nr_to_scan = atomic64_read(&fs_info->extent_map_shrinker_nr_to_scan);
|
ctx.nr_to_scan = atomic64_read(&fs_info->em_shrinker_nr_to_scan);
|
||||||
|
|
||||||
start_root_id = fs_info->extent_map_shrinker_last_root;
|
start_root_id = fs_info->em_shrinker_last_root;
|
||||||
next_root_id = fs_info->extent_map_shrinker_last_root;
|
next_root_id = fs_info->em_shrinker_last_root;
|
||||||
|
|
||||||
if (trace_btrfs_extent_map_shrinker_scan_enter_enabled()) {
|
if (trace_btrfs_extent_map_shrinker_scan_enter_enabled()) {
|
||||||
s64 nr = percpu_counter_sum_positive(&fs_info->evictable_extent_maps);
|
s64 nr = percpu_counter_sum_positive(&fs_info->evictable_extent_maps);
|
||||||
@ -1289,8 +1289,8 @@ static void btrfs_extent_map_shrinker_worker(struct work_struct *work)
|
|||||||
spin_unlock(&fs_info->fs_roots_radix_lock);
|
spin_unlock(&fs_info->fs_roots_radix_lock);
|
||||||
if (start_root_id > 0 && !cycled) {
|
if (start_root_id > 0 && !cycled) {
|
||||||
next_root_id = 0;
|
next_root_id = 0;
|
||||||
fs_info->extent_map_shrinker_last_root = 0;
|
fs_info->em_shrinker_last_root = 0;
|
||||||
fs_info->extent_map_shrinker_last_ino = 0;
|
fs_info->em_shrinker_last_ino = 0;
|
||||||
cycled = true;
|
cycled = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1315,7 +1315,7 @@ static void btrfs_extent_map_shrinker_worker(struct work_struct *work)
|
|||||||
trace_btrfs_extent_map_shrinker_scan_exit(fs_info, nr_dropped, nr);
|
trace_btrfs_extent_map_shrinker_scan_exit(fs_info, nr_dropped, nr);
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic64_set(&fs_info->extent_map_shrinker_nr_to_scan, 0);
|
atomic64_set(&fs_info->em_shrinker_nr_to_scan, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void btrfs_free_extent_maps(struct btrfs_fs_info *fs_info, long nr_to_scan)
|
void btrfs_free_extent_maps(struct btrfs_fs_info *fs_info, long nr_to_scan)
|
||||||
@ -1335,14 +1335,14 @@ void btrfs_free_extent_maps(struct btrfs_fs_info *fs_info, long nr_to_scan)
|
|||||||
* current value is zero, instead of incrementing the counter by
|
* current value is zero, instead of incrementing the counter by
|
||||||
* nr_to_scan.
|
* nr_to_scan.
|
||||||
*/
|
*/
|
||||||
if (atomic64_cmpxchg(&fs_info->extent_map_shrinker_nr_to_scan, 0, nr_to_scan) != 0)
|
if (atomic64_cmpxchg(&fs_info->em_shrinker_nr_to_scan, 0, nr_to_scan) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
queue_work(system_unbound_wq, &fs_info->extent_map_shrinker_work);
|
queue_work(system_unbound_wq, &fs_info->em_shrinker_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
void btrfs_init_extent_map_shrinker_work(struct btrfs_fs_info *fs_info)
|
void btrfs_init_extent_map_shrinker_work(struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
atomic64_set(&fs_info->extent_map_shrinker_nr_to_scan, 0);
|
atomic64_set(&fs_info->em_shrinker_nr_to_scan, 0);
|
||||||
INIT_WORK(&fs_info->extent_map_shrinker_work, btrfs_extent_map_shrinker_worker);
|
INIT_WORK(&fs_info->em_shrinker_work, btrfs_extent_map_shrinker_worker);
|
||||||
}
|
}
|
||||||
|
@ -635,10 +635,10 @@ struct btrfs_fs_info {
|
|||||||
s32 delalloc_batch;
|
s32 delalloc_batch;
|
||||||
|
|
||||||
struct percpu_counter evictable_extent_maps;
|
struct percpu_counter evictable_extent_maps;
|
||||||
u64 extent_map_shrinker_last_root;
|
u64 em_shrinker_last_root;
|
||||||
u64 extent_map_shrinker_last_ino;
|
u64 em_shrinker_last_ino;
|
||||||
atomic64_t extent_map_shrinker_nr_to_scan;
|
atomic64_t em_shrinker_nr_to_scan;
|
||||||
struct work_struct extent_map_shrinker_work;
|
struct work_struct em_shrinker_work;
|
||||||
|
|
||||||
/* Protected by 'trans_lock'. */
|
/* Protected by 'trans_lock'. */
|
||||||
struct list_head dirty_cowonly_roots;
|
struct list_head dirty_cowonly_roots;
|
||||||
|
@ -2568,10 +2568,10 @@ TRACE_EVENT(btrfs_extent_map_shrinker_scan_enter,
|
|||||||
|
|
||||||
TP_fast_assign_btrfs(fs_info,
|
TP_fast_assign_btrfs(fs_info,
|
||||||
__entry->nr_to_scan = \
|
__entry->nr_to_scan = \
|
||||||
atomic64_read(&fs_info->extent_map_shrinker_nr_to_scan);
|
atomic64_read(&fs_info->em_shrinker_nr_to_scan);
|
||||||
__entry->nr = nr;
|
__entry->nr = nr;
|
||||||
__entry->last_root_id = fs_info->extent_map_shrinker_last_root;
|
__entry->last_root_id = fs_info->em_shrinker_last_root;
|
||||||
__entry->last_ino = fs_info->extent_map_shrinker_last_ino;
|
__entry->last_ino = fs_info->em_shrinker_last_ino;
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk_btrfs("nr_to_scan=%ld nr=%ld last_root=%llu(%s) last_ino=%llu",
|
TP_printk_btrfs("nr_to_scan=%ld nr=%ld last_root=%llu(%s) last_ino=%llu",
|
||||||
@ -2595,8 +2595,8 @@ TRACE_EVENT(btrfs_extent_map_shrinker_scan_exit,
|
|||||||
TP_fast_assign_btrfs(fs_info,
|
TP_fast_assign_btrfs(fs_info,
|
||||||
__entry->nr_dropped = nr_dropped;
|
__entry->nr_dropped = nr_dropped;
|
||||||
__entry->nr = nr;
|
__entry->nr = nr;
|
||||||
__entry->last_root_id = fs_info->extent_map_shrinker_last_root;
|
__entry->last_root_id = fs_info->em_shrinker_last_root;
|
||||||
__entry->last_ino = fs_info->extent_map_shrinker_last_ino;
|
__entry->last_ino = fs_info->em_shrinker_last_ino;
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk_btrfs("nr_dropped=%ld nr=%ld last_root=%llu(%s) last_ino=%llu",
|
TP_printk_btrfs("nr_dropped=%ld nr=%ld last_root=%llu(%s) last_ino=%llu",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user