f2fs: add proc entry to show victim_secmap bitmap
This patch adds a new proc entry to show victim_secmap information in more detail, which is very helpful to know the get_victim candidate status clearly, and helpful to debug problems (e.g., some sections can not gc all of its blocks, since some blocks belong to atomic file, leaving victim_secmap with section bit setting, in extrem case, this will lead all bytes of victim_secmap setting with 0xff). Signed-off-by: Yunlong Song <yunlong.song@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
b404b3cbb8
commit
bd293daff1
1 changed files with 26 additions and 0 deletions
|
@ -615,6 +615,28 @@ static int __maybe_unused iostat_info_seq_show(struct seq_file *seq,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __maybe_unused victim_bits_seq_show(struct seq_file *seq,
|
||||||
|
void *offset)
|
||||||
|
{
|
||||||
|
struct super_block *sb = seq->private;
|
||||||
|
struct f2fs_sb_info *sbi = F2FS_SB(sb);
|
||||||
|
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
seq_puts(seq, "format: victim_secmap bitmaps\n");
|
||||||
|
|
||||||
|
for (i = 0; i < MAIN_SECS(sbi); i++) {
|
||||||
|
if ((i % 10) == 0)
|
||||||
|
seq_printf(seq, "%-10d", i);
|
||||||
|
seq_printf(seq, "%d", test_bit(i, dirty_i->victim_secmap) ? 1 : 0);
|
||||||
|
if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1))
|
||||||
|
seq_putc(seq, '\n');
|
||||||
|
else
|
||||||
|
seq_putc(seq, ' ');
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#define F2FS_PROC_FILE_DEF(_name) \
|
#define F2FS_PROC_FILE_DEF(_name) \
|
||||||
static int _name##_open_fs(struct inode *inode, struct file *file) \
|
static int _name##_open_fs(struct inode *inode, struct file *file) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -631,6 +653,7 @@ static const struct file_operations f2fs_seq_##_name##_fops = { \
|
||||||
F2FS_PROC_FILE_DEF(segment_info);
|
F2FS_PROC_FILE_DEF(segment_info);
|
||||||
F2FS_PROC_FILE_DEF(segment_bits);
|
F2FS_PROC_FILE_DEF(segment_bits);
|
||||||
F2FS_PROC_FILE_DEF(iostat_info);
|
F2FS_PROC_FILE_DEF(iostat_info);
|
||||||
|
F2FS_PROC_FILE_DEF(victim_bits);
|
||||||
|
|
||||||
int __init f2fs_init_sysfs(void)
|
int __init f2fs_init_sysfs(void)
|
||||||
{
|
{
|
||||||
|
@ -681,6 +704,8 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
|
||||||
&f2fs_seq_segment_bits_fops, sb);
|
&f2fs_seq_segment_bits_fops, sb);
|
||||||
proc_create_data("iostat_info", S_IRUGO, sbi->s_proc,
|
proc_create_data("iostat_info", S_IRUGO, sbi->s_proc,
|
||||||
&f2fs_seq_iostat_info_fops, sb);
|
&f2fs_seq_iostat_info_fops, sb);
|
||||||
|
proc_create_data("victim_bits", S_IRUGO, sbi->s_proc,
|
||||||
|
&f2fs_seq_victim_bits_fops, sb);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -691,6 +716,7 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
|
||||||
remove_proc_entry("iostat_info", sbi->s_proc);
|
remove_proc_entry("iostat_info", sbi->s_proc);
|
||||||
remove_proc_entry("segment_info", sbi->s_proc);
|
remove_proc_entry("segment_info", sbi->s_proc);
|
||||||
remove_proc_entry("segment_bits", sbi->s_proc);
|
remove_proc_entry("segment_bits", sbi->s_proc);
|
||||||
|
remove_proc_entry("victim_bits", sbi->s_proc);
|
||||||
remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
|
remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
|
||||||
}
|
}
|
||||||
kobject_del(&sbi->s_kobj);
|
kobject_del(&sbi->s_kobj);
|
||||||
|
|
Loading…
Add table
Reference in a new issue