Add lazytime patches
[ext4-patch-queue.git] / add-squelch-errors-support
blob768a11d25b5a0fe4e8dae099ac98c0b70abffbc6
1 ext4: add option for squelching ext4 errors to prevent dmesg from filling up
3 Only print one error per inode; this is enough to know that something
4 is wrong with an inode, without filling dmesg by spamming the system
5 with messages over and over again.
7 This is enabled via sysfs option, which is currently off by default.
8 Some environments may want to turn this on by default.  Eventually we
9 may want to make this be something which is tunable by a superblock
10 flag, perhaps.
12 Addresses-Google-Bug: #2507977
14 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 ---
16  fs/ext4/ext4.h  | 2 ++
17  fs/ext4/super.c | 2 ++
18  2 files changed, 4 insertions(+)
20 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
21 index 7600dbd..ef9bf04 100644
22 --- a/fs/ext4/ext4.h
23 +++ b/fs/ext4/ext4.h
24 @@ -1179,6 +1179,7 @@ struct ext4_super_block {
25   */
26  #define EXT4_MF_MNTDIR_SAMPLED 0x0001
27  #define EXT4_MF_FS_ABORTED     0x0002  /* Fatal error detected */
28 +#define EXT4_MF_FS_SQUELCH     0x0004  /* Squelch file system errors */
30  /* Number of quota types we support */
31  #define EXT4_MAXQUOTAS 2
32 @@ -1417,6 +1418,7 @@ enum {
33         EXT4_STATE_MAY_INLINE_DATA,     /* may have in-inode data */
34         EXT4_STATE_ORDERED_MODE,        /* data=ordered mode */
35         EXT4_STATE_EXT_PRECACHED,       /* extents have been precached */
36 +       EXT4_STATE_ERR_SQUELCHED,       /* squeched error */
37  };
39  #define EXT4_INODE_BIT_FNS(name, field, offset)                                \
40 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
41 index 2d294b7..54ac1e5 100644
42 --- a/fs/ext4/super.c
43 +++ b/fs/ext4/super.c
44 @@ -2774,6 +2774,7 @@ EXT4_RW_ATTR_SBI_UI(msg_ratelimit_burst, s_msg_ratelimit_state.burst);
45  EXT4_RO_ATTR_ES_UI(errors_count, s_error_count);
46  EXT4_RO_ATTR_ES_UI(first_error_time, s_first_error_time);
47  EXT4_RO_ATTR_ES_UI(last_error_time, s_last_error_time);
48 +EXT4_RW_ATTR_SBI_BOOL(squelch_errors, s_mount_flags, EXT4_MF_FS_SQUELCH);
50  static struct attribute *ext4_attrs[] = {
51         ATTR_LIST(delayed_allocation_blocks),
52 @@ -2800,6 +2801,7 @@ static struct attribute *ext4_attrs[] = {
53         ATTR_LIST(errors_count),
54         ATTR_LIST(first_error_time),
55         ATTR_LIST(last_error_time),
56 +       ATTR_LIST(squelch_errors),
57         NULL,
58  };