mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
ext4: add fast commit stats in procfs
This commit adds a file in procfs that tracks fast commit related statistics. root@kvm-xfstests:/mnt# cat /proc/fs/ext4/vdc/fc_info fc stats: 7772 commits 15 ineligible 4083 numblks 2242us avg_commit_time Ineligible reasons: "Extended attributes changed": 0 "Cross rename": 0 "Journal flag changed": 0 "Insufficient memory": 0 "Swap boot": 0 "Resize": 0 "Dir renamed": 0 "Falloc range op": 0 "FC Commit Failed": 15 Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Link: https://lore.kernel.org/r/20201015203802.3597742-10-harshadshirwadkar@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
0f0672ffb6
commit
ce8c59d197
fs/ext4
@ -2740,7 +2740,7 @@ extern int ext4_init_inode_table(struct super_block *sb,
|
|||||||
extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate);
|
extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate);
|
||||||
|
|
||||||
/* fast_commit.c */
|
/* fast_commit.c */
|
||||||
|
int ext4_fc_info_show(struct seq_file *seq, void *v);
|
||||||
void ext4_fc_init(struct super_block *sb, journal_t *journal);
|
void ext4_fc_init(struct super_block *sb, journal_t *journal);
|
||||||
void ext4_fc_init_inode(struct inode *inode);
|
void ext4_fc_init_inode(struct inode *inode);
|
||||||
void ext4_fc_track_range(struct inode *inode, ext4_lblk_t start,
|
void ext4_fc_track_range(struct inode *inode, ext4_lblk_t start,
|
||||||
|
@ -2093,6 +2093,40 @@ void ext4_fc_init(struct super_block *sb, journal_t *journal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *fc_ineligible_reasons[] = {
|
||||||
|
"Extended attributes changed",
|
||||||
|
"Cross rename",
|
||||||
|
"Journal flag changed",
|
||||||
|
"Insufficient memory",
|
||||||
|
"Swap boot",
|
||||||
|
"Resize",
|
||||||
|
"Dir renamed",
|
||||||
|
"Falloc range op",
|
||||||
|
"FC Commit Failed"
|
||||||
|
};
|
||||||
|
|
||||||
|
int ext4_fc_info_show(struct seq_file *seq, void *v)
|
||||||
|
{
|
||||||
|
struct ext4_sb_info *sbi = EXT4_SB((struct super_block *)seq->private);
|
||||||
|
struct ext4_fc_stats *stats = &sbi->s_fc_stats;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (v != SEQ_START_TOKEN)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
seq_printf(seq,
|
||||||
|
"fc stats:\n%ld commits\n%ld ineligible\n%ld numblks\n%lluus avg_commit_time\n",
|
||||||
|
stats->fc_num_commits, stats->fc_ineligible_commits,
|
||||||
|
stats->fc_numblks,
|
||||||
|
div_u64(sbi->s_fc_avg_commit_time, 1000));
|
||||||
|
seq_puts(seq, "Ineligible reasons:\n");
|
||||||
|
for (i = 0; i < EXT4_FC_REASON_MAX; i++)
|
||||||
|
seq_printf(seq, "\"%s\":\t%d\n", fc_ineligible_reasons[i],
|
||||||
|
stats->fc_ineligible_reason_count[i]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __init ext4_fc_init_dentry_cache(void)
|
int __init ext4_fc_init_dentry_cache(void)
|
||||||
{
|
{
|
||||||
ext4_fc_dentry_cachep = KMEM_CACHE(ext4_fc_dentry_update,
|
ext4_fc_dentry_cachep = KMEM_CACHE(ext4_fc_dentry_update,
|
||||||
|
@ -521,6 +521,8 @@ int ext4_register_sysfs(struct super_block *sb)
|
|||||||
proc_create_single_data("es_shrinker_info", S_IRUGO,
|
proc_create_single_data("es_shrinker_info", S_IRUGO,
|
||||||
sbi->s_proc, ext4_seq_es_shrinker_info_show,
|
sbi->s_proc, ext4_seq_es_shrinker_info_show,
|
||||||
sb);
|
sb);
|
||||||
|
proc_create_single_data("fc_info", 0444, sbi->s_proc,
|
||||||
|
ext4_fc_info_show, sb);
|
||||||
proc_create_seq_data("mb_groups", S_IRUGO, sbi->s_proc,
|
proc_create_seq_data("mb_groups", S_IRUGO, sbi->s_proc,
|
||||||
&ext4_mb_seq_groups_ops, sb);
|
&ext4_mb_seq_groups_ops, sb);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user