@@ -2380,7 +2380,10 @@ struct ext4_attr {
2380
2380
ssize_t (* show )(struct ext4_attr * , struct ext4_sb_info * , char * );
2381
2381
ssize_t (* store )(struct ext4_attr * , struct ext4_sb_info * ,
2382
2382
const char * , size_t );
2383
- int offset ;
2383
+ union {
2384
+ int offset ;
2385
+ int deprecated_val ;
2386
+ } u ;
2384
2387
};
2385
2388
2386
2389
static int parse_strtoull (const char * buf ,
@@ -2449,7 +2452,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
2449
2452
static ssize_t sbi_ui_show (struct ext4_attr * a ,
2450
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
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
2461
struct ext4_sb_info * sbi ,
2459
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
2465
unsigned long t ;
2463
2466
int ret ;
2464
2467
@@ -2507,12 +2510,20 @@ static ssize_t trigger_test_error(struct ext4_attr *a,
2507
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
2519
#define EXT4_ATTR_OFFSET (_name ,_mode ,_show ,_store ,_elname ) \
2511
2520
static struct ext4_attr ext4_attr_##_name = { \
2512
2521
.attr = {.name = __stringify(_name), .mode = _mode }, \
2513
2522
.show = _show, \
2514
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
2528
#define EXT4_ATTR (name , mode , show , store ) \
2518
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
2534
#define EXT4_RW_ATTR_SBI_UI (name , elname ) \
2524
2535
EXT4_ATTR_OFFSET(name, 0644, sbi_ui_show, sbi_ui_store, elname)
2525
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
2546
EXT4_RO_ATTR (delayed_allocation_blocks );
2528
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
2556
EXT4_RW_ATTR_SBI_UI (mb_order2_req , s_mb_order2_reqs );
2538
2557
EXT4_RW_ATTR_SBI_UI (mb_stream_req , s_mb_stream_request );
2539
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
2560
EXT4_RW_ATTR_SBI_UI (extent_max_zeroout_kb , s_extent_max_zeroout_kb );
2542
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
3811
sbi -> s_stripe = ext4_get_stripe_size (sbi );
3793
- sbi -> s_max_writeback_mb_bump = 128 ;
3794
3812
sbi -> s_extent_max_zeroout_kb = 32 ;
3795
3813
3796
3814
/*
0 commit comments