Skip to content

Commit f2d50a6

Browse files
jankaratytso
authored andcommitted
ext4: deprecate max_writeback_mb_bump sysfs attribute
This attribute is now unused so deprecate it. We still show the old default value to keep some compatibility but we don't allow writing to that attribute anymore. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent 39bba40 commit f2d50a6

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

fs/ext4/ext4.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,6 @@ struct ext4_sb_info {
12411241
unsigned int s_mb_stats;
12421242
unsigned int s_mb_order2_reqs;
12431243
unsigned int s_mb_group_prealloc;
1244-
unsigned int s_max_writeback_mb_bump;
12451244
unsigned int s_max_dir_size_kb;
12461245
/* where last allocation was done - for stream allocation */
12471246
unsigned long s_mb_last_group;

fs/ext4/super.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,7 +2380,10 @@ struct ext4_attr {
23802380
ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *);
23812381
ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *,
23822382
const char *, size_t);
2383-
int offset;
2383+
union {
2384+
int offset;
2385+
int deprecated_val;
2386+
} u;
23842387
};
23852388

23862389
static int parse_strtoull(const char *buf,
@@ -2449,7 +2452,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
24492452
static ssize_t sbi_ui_show(struct ext4_attr *a,
24502453
struct ext4_sb_info *sbi, char *buf)
24512454
{
2452-
unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset);
2455+
unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
24532456

24542457
return snprintf(buf, PAGE_SIZE, "%u\n", *ui);
24552458
}
@@ -2458,7 +2461,7 @@ static ssize_t sbi_ui_store(struct ext4_attr *a,
24582461
struct ext4_sb_info *sbi,
24592462
const char *buf, size_t count)
24602463
{
2461-
unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset);
2464+
unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
24622465
unsigned long t;
24632466
int ret;
24642467

@@ -2507,12 +2510,20 @@ static ssize_t trigger_test_error(struct ext4_attr *a,
25072510
return count;
25082511
}
25092512

2513+
static ssize_t sbi_deprecated_show(struct ext4_attr *a,
2514+
struct ext4_sb_info *sbi, char *buf)
2515+
{
2516+
return snprintf(buf, PAGE_SIZE, "%d\n", a->u.deprecated_val);
2517+
}
2518+
25102519
#define EXT4_ATTR_OFFSET(_name,_mode,_show,_store,_elname) \
25112520
static struct ext4_attr ext4_attr_##_name = { \
25122521
.attr = {.name = __stringify(_name), .mode = _mode }, \
25132522
.show = _show, \
25142523
.store = _store, \
2515-
.offset = offsetof(struct ext4_sb_info, _elname), \
2524+
.u = { \
2525+
.offset = offsetof(struct ext4_sb_info, _elname),\
2526+
}, \
25162527
}
25172528
#define EXT4_ATTR(name, mode, show, store) \
25182529
static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
@@ -2523,6 +2534,14 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
25232534
#define EXT4_RW_ATTR_SBI_UI(name, elname) \
25242535
EXT4_ATTR_OFFSET(name, 0644, sbi_ui_show, sbi_ui_store, elname)
25252536
#define ATTR_LIST(name) &ext4_attr_##name.attr
2537+
#define EXT4_DEPRECATED_ATTR(_name, _val) \
2538+
static struct ext4_attr ext4_attr_##_name = { \
2539+
.attr = {.name = __stringify(_name), .mode = 0444 }, \
2540+
.show = sbi_deprecated_show, \
2541+
.u = { \
2542+
.deprecated_val = _val, \
2543+
}, \
2544+
}
25262545

25272546
EXT4_RO_ATTR(delayed_allocation_blocks);
25282547
EXT4_RO_ATTR(session_write_kbytes);
@@ -2537,7 +2556,7 @@ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
25372556
EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
25382557
EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
25392558
EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
2540-
EXT4_RW_ATTR_SBI_UI(max_writeback_mb_bump, s_max_writeback_mb_bump);
2559+
EXT4_DEPRECATED_ATTR(max_writeback_mb_bump, 128);
25412560
EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
25422561
EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error);
25432562

@@ -3790,7 +3809,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
37903809
}
37913810

37923811
sbi->s_stripe = ext4_get_stripe_size(sbi);
3793-
sbi->s_max_writeback_mb_bump = 128;
37943812
sbi->s_extent_max_zeroout_kb = 32;
37953813

37963814
/*

0 commit comments

Comments
 (0)