diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 1 | ||||
-rw-r--r-- | fs/ext4/super.c | 30 |
2 files changed, 24 insertions, 7 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 82d2b6000a61..46674058d251 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1241,7 +1241,6 @@ struct ext4_sb_info { | |||
1241 | unsigned int s_mb_stats; | 1241 | unsigned int s_mb_stats; |
1242 | unsigned int s_mb_order2_reqs; | 1242 | unsigned int s_mb_order2_reqs; |
1243 | unsigned int s_mb_group_prealloc; | 1243 | unsigned int s_mb_group_prealloc; |
1244 | unsigned int s_max_writeback_mb_bump; | ||
1245 | unsigned int s_max_dir_size_kb; | 1244 | unsigned int s_max_dir_size_kb; |
1246 | /* where last allocation was done - for stream allocation */ | 1245 | /* where last allocation was done - for stream allocation */ |
1247 | unsigned long s_mb_last_group; | 1246 | unsigned long s_mb_last_group; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index a9c143820f7d..eac4d3081ba4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2380,7 +2380,10 @@ struct ext4_attr { | |||
2380 | ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *); | 2380 | ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *); |
2381 | ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *, | 2381 | ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *, |
2382 | const char *, size_t); | 2382 | const char *, size_t); |
2383 | int offset; | 2383 | union { |
2384 | int offset; | ||
2385 | int deprecated_val; | ||
2386 | } u; | ||
2384 | }; | 2387 | }; |
2385 | 2388 | ||
2386 | static int parse_strtoull(const char *buf, | 2389 | static int parse_strtoull(const char *buf, |
@@ -2449,7 +2452,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a, | |||
2449 | static ssize_t sbi_ui_show(struct ext4_attr *a, | 2452 | static ssize_t sbi_ui_show(struct ext4_attr *a, |
2450 | struct ext4_sb_info *sbi, char *buf) | 2453 | struct ext4_sb_info *sbi, char *buf) |
2451 | { | 2454 | { |
2452 | unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset); | 2455 | unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset); |
2453 | 2456 | ||
2454 | return snprintf(buf, PAGE_SIZE, "%u\n", *ui); | 2457 | return snprintf(buf, PAGE_SIZE, "%u\n", *ui); |
2455 | } | 2458 | } |
@@ -2458,7 +2461,7 @@ static ssize_t sbi_ui_store(struct ext4_attr *a, | |||
2458 | struct ext4_sb_info *sbi, | 2461 | struct ext4_sb_info *sbi, |
2459 | const char *buf, size_t count) | 2462 | const char *buf, size_t count) |
2460 | { | 2463 | { |
2461 | unsigned int *ui = (unsigned int *) (((char *) sbi) + a->offset); | 2464 | unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset); |
2462 | unsigned long t; | 2465 | unsigned long t; |
2463 | int ret; | 2466 | int ret; |
2464 | 2467 | ||
@@ -2507,12 +2510,20 @@ static ssize_t trigger_test_error(struct ext4_attr *a, | |||
2507 | return count; | 2510 | return count; |
2508 | } | 2511 | } |
2509 | 2512 | ||
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 | |||
2510 | #define EXT4_ATTR_OFFSET(_name,_mode,_show,_store,_elname) \ | 2519 | #define EXT4_ATTR_OFFSET(_name,_mode,_show,_store,_elname) \ |
2511 | static struct ext4_attr ext4_attr_##_name = { \ | 2520 | static struct ext4_attr ext4_attr_##_name = { \ |
2512 | .attr = {.name = __stringify(_name), .mode = _mode }, \ | 2521 | .attr = {.name = __stringify(_name), .mode = _mode }, \ |
2513 | .show = _show, \ | 2522 | .show = _show, \ |
2514 | .store = _store, \ | 2523 | .store = _store, \ |
2515 | .offset = offsetof(struct ext4_sb_info, _elname), \ | 2524 | .u = { \ |
2525 | .offset = offsetof(struct ext4_sb_info, _elname),\ | ||
2526 | }, \ | ||
2516 | } | 2527 | } |
2517 | #define EXT4_ATTR(name, mode, show, store) \ | 2528 | #define EXT4_ATTR(name, mode, show, store) \ |
2518 | static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store) | 2529 | 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) | |||
2523 | #define EXT4_RW_ATTR_SBI_UI(name, elname) \ | 2534 | #define EXT4_RW_ATTR_SBI_UI(name, elname) \ |
2524 | EXT4_ATTR_OFFSET(name, 0644, sbi_ui_show, sbi_ui_store, elname) | 2535 | EXT4_ATTR_OFFSET(name, 0644, sbi_ui_show, sbi_ui_store, elname) |
2525 | #define ATTR_LIST(name) &ext4_attr_##name.attr | 2536 | #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 | } | ||
2526 | 2545 | ||
2527 | EXT4_RO_ATTR(delayed_allocation_blocks); | 2546 | EXT4_RO_ATTR(delayed_allocation_blocks); |
2528 | EXT4_RO_ATTR(session_write_kbytes); | 2547 | EXT4_RO_ATTR(session_write_kbytes); |
@@ -2537,7 +2556,7 @@ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan); | |||
2537 | EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs); | 2556 | EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs); |
2538 | EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request); | 2557 | EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request); |
2539 | EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc); | 2558 | 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); |
2541 | EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb); | 2560 | EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb); |
2542 | EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error); | 2561 | EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error); |
2543 | 2562 | ||
@@ -3790,7 +3809,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3790 | } | 3809 | } |
3791 | 3810 | ||
3792 | sbi->s_stripe = ext4_get_stripe_size(sbi); | 3811 | sbi->s_stripe = ext4_get_stripe_size(sbi); |
3793 | sbi->s_max_writeback_mb_bump = 128; | ||
3794 | sbi->s_extent_max_zeroout_kb = 32; | 3812 | sbi->s_extent_max_zeroout_kb = 32; |
3795 | 3813 | ||
3796 | /* | 3814 | /* |