add patch better-estimate-credits-needed-for-ext4_da_writepages
[ext4-patch-queue.git] / deprecate-max_writeback_sb_bump-sysfs-attribute
blob9e933b73caf8b75f39b2ad99f19f5ed3d4992f7f
1 ext4: deprecate max_writeback_mb_bump sysfs attribute
3 From: Jan Kara <jack@suse.cz>
5 This attribute is now unused so deprecate it.  We still show the old
6 default value to keep some compatibility but we don't allow writing to
7 that attribute anymore.
9 Signed-off-by: Jan Kara <jack@suse.cz>
10 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 ---
12  fs/ext4/ext4.h  |  1 -
13  fs/ext4/super.c | 30 ++++++++++++++++++++++++------
14  2 files changed, 24 insertions(+), 7 deletions(-)
16 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
17 index 0aabb34..d260fb7 100644
18 --- a/fs/ext4/ext4.h
19 +++ b/fs/ext4/ext4.h
20 @@ -1246,7 +1246,6 @@ struct ext4_sb_info {
21         unsigned int s_mb_stats;
22         unsigned int s_mb_order2_reqs;
23         unsigned int s_mb_group_prealloc;
24 -       unsigned int s_max_writeback_mb_bump;
25         unsigned int s_max_dir_size_kb;
26         /* where last allocation was done - for stream allocation */
27         unsigned long s_mb_last_group;
28 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
29 index 94cc84d..18bd6dd 100644
30 --- a/fs/ext4/super.c
31 +++ b/fs/ext4/super.c
32 @@ -2377,7 +2377,10 @@ struct ext4_attr {
33         ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *);
34         ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *,
35                          const char *, size_t);
36 -       int offset;
37 +       union {
38 +               int offset;
39 +               int deprecated_val;
40 +       } u;
41  };
43  static int parse_strtoull(const char *buf,
44 @@ -2446,7 +2449,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
45  static ssize_t sbi_ui_show(struct ext4_attr *a,
46                            struct ext4_sb_info *sbi, char *buf)
47  {
48 -       unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset);
49 +       unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
51         return snprintf(buf, PAGE_SIZE, "%u\n", *ui);
52  }
53 @@ -2455,7 +2458,7 @@ static ssize_t sbi_ui_store(struct ext4_attr *a,
54                             struct ext4_sb_info *sbi,
55                             const char *buf, size_t count)
56  {
57 -       unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset);
58 +       unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
59         unsigned long t;
60         int ret;
62 @@ -2504,12 +2507,20 @@ static ssize_t trigger_test_error(struct ext4_attr *a,
63         return count;
64  }
66 +static ssize_t sbi_deprecated_show(struct ext4_attr *a,
67 +                                  struct ext4_sb_info *sbi, char *buf)
69 +       return snprintf(buf, PAGE_SIZE, "%d\n", a->u.deprecated_val);
72  #define EXT4_ATTR_OFFSET(_name,_mode,_show,_store,_elname) \
73  static struct ext4_attr ext4_attr_##_name = {                  \
74         .attr = {.name = __stringify(_name), .mode = _mode },   \
75         .show   = _show,                                        \
76         .store  = _store,                                       \
77 -       .offset = offsetof(struct ext4_sb_info, _elname),       \
78 +       .u = {                                                  \
79 +               .offset = offsetof(struct ext4_sb_info, _elname),\
80 +       },                                                      \
81  }
82  #define EXT4_ATTR(name, mode, show, store) \
83  static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
84 @@ -2520,6 +2531,14 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
85  #define EXT4_RW_ATTR_SBI_UI(name, elname)      \
86         EXT4_ATTR_OFFSET(name, 0644, sbi_ui_show, sbi_ui_store, elname)
87  #define ATTR_LIST(name) &ext4_attr_##name.attr
88 +#define EXT4_DEPRECATED_ATTR(_name, _val)      \
89 +static struct ext4_attr ext4_attr_##_name = {                  \
90 +       .attr = {.name = __stringify(_name), .mode = 0444 },    \
91 +       .show   = sbi_deprecated_show,                          \
92 +       .u = {                                                  \
93 +               .deprecated_val = _val,                         \
94 +       },                                                      \
97  EXT4_RO_ATTR(delayed_allocation_blocks);
98  EXT4_RO_ATTR(session_write_kbytes);
99 @@ -2534,7 +2553,7 @@ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
100  EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
101  EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
102  EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
103 -EXT4_RW_ATTR_SBI_UI(max_writeback_mb_bump, s_max_writeback_mb_bump);
104 +EXT4_DEPRECATED_ATTR(max_writeback_mb_bump, 128);
105  EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
106  EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error);
108 @@ -3787,7 +3806,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
109         }
111         sbi->s_stripe = ext4_get_stripe_size(sbi);
112 -       sbi->s_max_writeback_mb_bump = 128;
113         sbi->s_extent_max_zeroout_kb = 32;
115         /*
116 -- 
117 1.8.1.4