@@ -2090,9 +2090,14 @@ static int ext4_set_test_dummy_encryption(struct super_block *sb,
2090
2090
return 1 ;
2091
2091
}
2092
2092
2093
+ struct ext4_parsed_options {
2094
+ unsigned long journal_devnum ;
2095
+ unsigned int journal_ioprio ;
2096
+ };
2097
+
2093
2098
static int handle_mount_opt (struct super_block * sb , char * opt , int token ,
2094
- substring_t * args , unsigned long * journal_devnum ,
2095
- unsigned int * journal_ioprio , int is_remount )
2099
+ substring_t * args , struct ext4_parsed_options * parsed_opts ,
2100
+ int is_remount )
2096
2101
{
2097
2102
struct ext4_sb_info * sbi = EXT4_SB (sb );
2098
2103
const struct mount_opts * m ;
@@ -2249,7 +2254,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
2249
2254
"Cannot specify journal on remount" );
2250
2255
return -1 ;
2251
2256
}
2252
- * journal_devnum = arg ;
2257
+ parsed_opts -> journal_devnum = arg ;
2253
2258
} else if (token == Opt_journal_path ) {
2254
2259
char * journal_path ;
2255
2260
struct inode * journal_inode ;
@@ -2285,7 +2290,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
2285
2290
return -1 ;
2286
2291
}
2287
2292
2288
- * journal_devnum = new_encode_dev (journal_inode -> i_rdev );
2293
+ parsed_opts -> journal_devnum = new_encode_dev (journal_inode -> i_rdev );
2289
2294
path_put (& path );
2290
2295
kfree (journal_path );
2291
2296
} else if (token == Opt_journal_ioprio ) {
@@ -2294,7 +2299,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
2294
2299
" (must be 0-7)" );
2295
2300
return -1 ;
2296
2301
}
2297
- * journal_ioprio =
2302
+ parsed_opts -> journal_ioprio =
2298
2303
IOPRIO_PRIO_VALUE (IOPRIO_CLASS_BE , arg );
2299
2304
} else if (token == Opt_test_dummy_encryption ) {
2300
2305
return ext4_set_test_dummy_encryption (sb , opt , & args [0 ],
@@ -2411,8 +2416,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
2411
2416
}
2412
2417
2413
2418
static int parse_options (char * options , struct super_block * sb ,
2414
- unsigned long * journal_devnum ,
2415
- unsigned int * journal_ioprio ,
2419
+ struct ext4_parsed_options * ret_opts ,
2416
2420
int is_remount )
2417
2421
{
2418
2422
struct ext4_sb_info __maybe_unused * sbi = EXT4_SB (sb );
@@ -2432,8 +2436,8 @@ static int parse_options(char *options, struct super_block *sb,
2432
2436
*/
2433
2437
args [0 ].to = args [0 ].from = NULL ;
2434
2438
token = match_token (p , tokens , args );
2435
- if (handle_mount_opt (sb , p , token , args , journal_devnum ,
2436
- journal_ioprio , is_remount ) < 0 )
2439
+ if (handle_mount_opt (sb , p , token , args , ret_opts ,
2440
+ is_remount ) < 0 )
2437
2441
return 0 ;
2438
2442
}
2439
2443
#ifdef CONFIG_QUOTA
@@ -4015,7 +4019,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4015
4019
ext4_fsblk_t sb_block = get_sb_block (& data );
4016
4020
ext4_fsblk_t logical_sb_block ;
4017
4021
unsigned long offset = 0 ;
4018
- unsigned long journal_devnum = 0 ;
4019
4022
unsigned long def_mount_opts ;
4020
4023
struct inode * root ;
4021
4024
const char * descr ;
@@ -4026,8 +4029,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4026
4029
int needs_recovery , has_huge_files ;
4027
4030
__u64 blocks_count ;
4028
4031
int err = 0 ;
4029
- unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO ;
4030
4032
ext4_group_t first_not_zeroed ;
4033
+ struct ext4_parsed_options parsed_opts ;
4034
+
4035
+ /* Set defaults for the variables that will be set during parsing */
4036
+ parsed_opts .journal_ioprio = DEFAULT_JOURNAL_IOPRIO ;
4037
+ parsed_opts .journal_devnum = 0 ;
4031
4038
4032
4039
if ((data && !orig_data ) || !sbi )
4033
4040
goto out_free_base ;
@@ -4273,17 +4280,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4273
4280
GFP_KERNEL );
4274
4281
if (!s_mount_opts )
4275
4282
goto failed_mount ;
4276
- if (!parse_options (s_mount_opts , sb , & journal_devnum ,
4277
- & journal_ioprio , 0 )) {
4283
+ if (!parse_options (s_mount_opts , sb , & parsed_opts , 0 )) {
4278
4284
ext4_msg (sb , KERN_WARNING ,
4279
4285
"failed to parse options in superblock: %s" ,
4280
4286
s_mount_opts );
4281
4287
}
4282
4288
kfree (s_mount_opts );
4283
4289
}
4284
4290
sbi -> s_def_mount_opt = sbi -> s_mount_opt ;
4285
- if (!parse_options ((char * ) data , sb , & journal_devnum ,
4286
- & journal_ioprio , 0 ))
4291
+ if (!parse_options ((char * ) data , sb , & parsed_opts , 0 ))
4287
4292
goto failed_mount ;
4288
4293
4289
4294
#ifdef CONFIG_UNICODE
@@ -4768,7 +4773,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4768
4773
* root first: it may be modified in the journal!
4769
4774
*/
4770
4775
if (!test_opt (sb , NOLOAD ) && ext4_has_feature_journal (sb )) {
4771
- err = ext4_load_journal (sb , es , journal_devnum );
4776
+ err = ext4_load_journal (sb , es , parsed_opts . journal_devnum );
4772
4777
if (err )
4773
4778
goto failed_mount3a ;
4774
4779
} else if (test_opt (sb , NOLOAD ) && !sb_rdonly (sb ) &&
@@ -4868,7 +4873,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4868
4873
goto failed_mount_wq ;
4869
4874
}
4870
4875
4871
- set_task_ioprio (sbi -> s_journal -> j_task , journal_ioprio );
4876
+ set_task_ioprio (sbi -> s_journal -> j_task , parsed_opts . journal_ioprio );
4872
4877
4873
4878
sbi -> s_journal -> j_submit_inode_data_buffers =
4874
4879
ext4_journal_submit_inode_data_buffers ;
@@ -5807,13 +5812,16 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
5807
5812
struct ext4_mount_options old_opts ;
5808
5813
int enable_quota = 0 ;
5809
5814
ext4_group_t g ;
5810
- unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO ;
5811
5815
int err = 0 ;
5812
5816
#ifdef CONFIG_QUOTA
5813
5817
int i , j ;
5814
5818
char * to_free [EXT4_MAXQUOTAS ];
5815
5819
#endif
5816
5820
char * orig_data = kstrdup (data , GFP_KERNEL );
5821
+ struct ext4_parsed_options parsed_opts ;
5822
+
5823
+ parsed_opts .journal_ioprio = DEFAULT_JOURNAL_IOPRIO ;
5824
+ parsed_opts .journal_devnum = 0 ;
5817
5825
5818
5826
if (data && !orig_data )
5819
5827
return - ENOMEM ;
@@ -5844,7 +5852,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
5844
5852
old_opts .s_qf_names [i ] = NULL ;
5845
5853
#endif
5846
5854
if (sbi -> s_journal && sbi -> s_journal -> j_task -> io_context )
5847
- journal_ioprio = sbi -> s_journal -> j_task -> io_context -> ioprio ;
5855
+ parsed_opts .journal_ioprio =
5856
+ sbi -> s_journal -> j_task -> io_context -> ioprio ;
5848
5857
5849
5858
/*
5850
5859
* Some options can be enabled by ext4 and/or by VFS mount flag
@@ -5854,7 +5863,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
5854
5863
vfs_flags = SB_LAZYTIME | SB_I_VERSION ;
5855
5864
sb -> s_flags = (sb -> s_flags & ~vfs_flags ) | (* flags & vfs_flags );
5856
5865
5857
- if (!parse_options (data , sb , NULL , & journal_ioprio , 1 )) {
5866
+ if (!parse_options (data , sb , & parsed_opts , 1 )) {
5858
5867
err = - EINVAL ;
5859
5868
goto restore_opts ;
5860
5869
}
@@ -5904,7 +5913,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
5904
5913
5905
5914
if (sbi -> s_journal ) {
5906
5915
ext4_init_journal_params (sb , sbi -> s_journal );
5907
- set_task_ioprio (sbi -> s_journal -> j_task , journal_ioprio );
5916
+ set_task_ioprio (sbi -> s_journal -> j_task , parsed_opts . journal_ioprio );
5908
5917
}
5909
5918
5910
5919
/* Flush outstanding errors before changing fs state */
0 commit comments