ext4: notify sysfs on errors_count value change
PATCH 1/1 ext4: notify sysfs on errors_count value change
After s_error_count is incremented, signal the change in the corresponding sysfs attribute via sysfs_notify. This allows userspace to poll() on changes to /sys/fs/ext4/*/errors_count.
Signed-off-by Jonathan Davies <[email protected]>
--- fs/ext4/ext4.h | 1 + fs/ext4/super.c | 1 + fs/ext4/sysfs.c | 7 +++++++ 3 files changed, 9 insertions(+)
fs/ext4/ext4.h +1 -0
@@ -3614,6 +3614,7 @@ extern const struct inode_operations ext4_symlink_inode_operations;extern const struct inode_operations ext4_fast_symlink_inode_operations;/* sysfs.c */ +extern void ext4_notify_error_sysfs (struct super_block *sb);extern int ext4_register_sysfs (struct super_block *sb);extern void ext4_unregister_sysfs (struct super_block *sb);extern int __init ext4_init_sysfs (void );
fs/ext4/super.c +1 -0
@@ -5579,6 +5579,7 @@ static void ext4_update_super(struct super_block *sb)if (!es->s_error_count)mod_timer (&sbi->s_err_report, jiffies +24 *60 *60 *HZ );le32_add_cpu (&es->s_error_count, sbi->s_add_error_count); +ext4_notify_error_sysfs (sb); sbi->s_add_error_count =0 ; }spin_unlock (&sbi->s_error_lock);
fs/ext4/sysfs.c +7 -0
@@ -506,6 +506,13 @@ static struct kobj_type ext4_feat_ktype = { .release = (void (*)(struct kobject *))kfree, }; +void ext4_notify_error_sysfs (struct super_block *sb) +{ +struct ext4_sb_info *sbi =EXT4_SB (sb); + +sysfs_notify (&sbi->s_kobj,NULL ,"errors_count" ); +} +static struct kobject *ext4_root;static struct kobject *ext4_feat;
Signature · 1 line
2.9.3
Quoted 5 lines · Jonathan Davies
After
s_error_countis incremented, signal the change in the corresponding sysfs attribute viasysfs_notify. This allows userspace topoll()on changes to/sys/fs/ext4/*/errors_count.Signed-off-by Jonathan Davies <[email protected]>
Applied, thanks.
- Ted