@@ -1003,10 +1003,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
10031003 seq_puts (seq , ",journal_checksum" );
10041004 if (test_opt (sb , I_VERSION ))
10051005 seq_puts (seq , ",i_version" );
1006- if (!test_opt (sb , DELALLOC ))
1006+ if (!test_opt (sb , DELALLOC ) &&
1007+ !(def_mount_opts & EXT4_DEFM_NODELALLOC ))
10071008 seq_puts (seq , ",nodelalloc" );
10081009
1009-
10101010 if (sbi -> s_stripe )
10111011 seq_printf (seq , ",stripe=%lu" , sbi -> s_stripe );
10121012 /*
@@ -1030,7 +1030,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
10301030 if (test_opt (sb , NO_AUTO_DA_ALLOC ))
10311031 seq_puts (seq , ",noauto_da_alloc" );
10321032
1033- if (test_opt (sb , DISCARD ))
1033+ if (test_opt (sb , DISCARD ) && !( def_mount_opts & EXT4_DEFM_DISCARD ) )
10341034 seq_puts (seq , ",discard" );
10351035
10361036 if (test_opt (sb , NOLOAD ))
@@ -1039,6 +1039,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
10391039 if (test_opt (sb , DIOREAD_NOLOCK ))
10401040 seq_puts (seq , ",dioread_nolock" );
10411041
1042+ if (test_opt (sb , BLOCK_VALIDITY ) &&
1043+ !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY ))
1044+ seq_puts (seq , ",block_validity" );
1045+
10421046 ext4_show_quota_options (seq , sb );
10431047
10441048 return 0 ;
@@ -2655,22 +2659,34 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
26552659 set_opt (sbi -> s_mount_opt , ERRORS_CONT );
26562660 else
26572661 set_opt (sbi -> s_mount_opt , ERRORS_RO );
2662+ if (def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY )
2663+ set_opt (sbi -> s_mount_opt , BLOCK_VALIDITY );
2664+ if (def_mount_opts & EXT4_DEFM_DISCARD )
2665+ set_opt (sbi -> s_mount_opt , DISCARD );
26582666
26592667 sbi -> s_resuid = le16_to_cpu (es -> s_def_resuid );
26602668 sbi -> s_resgid = le16_to_cpu (es -> s_def_resgid );
26612669 sbi -> s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ ;
26622670 sbi -> s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME ;
26632671 sbi -> s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME ;
26642672
2665- set_opt (sbi -> s_mount_opt , BARRIER );
2673+ if ((def_mount_opts & EXT4_DEFM_NOBARRIER ) == 0 )
2674+ set_opt (sbi -> s_mount_opt , BARRIER );
26662675
26672676 /*
26682677 * enable delayed allocation by default
26692678 * Use -o nodelalloc to turn it off
26702679 */
2671- if (!IS_EXT3_SB (sb ))
2680+ if (!IS_EXT3_SB (sb ) &&
2681+ ((def_mount_opts & EXT4_DEFM_NODELALLOC ) == 0 ))
26722682 set_opt (sbi -> s_mount_opt , DELALLOC );
26732683
2684+ if (!parse_options ((char * ) sbi -> s_es -> s_mount_opts , sb ,
2685+ & journal_devnum , & journal_ioprio , NULL , 0 )) {
2686+ ext4_msg (sb , KERN_WARNING ,
2687+ "failed to parse options in superblock: %s" ,
2688+ sbi -> s_es -> s_mount_opts );
2689+ }
26742690 if (!parse_options ((char * ) data , sb , & journal_devnum ,
26752691 & journal_ioprio , NULL , 0 ))
26762692 goto failed_mount ;
@@ -3141,7 +3157,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
31413157 descr = "out journal" ;
31423158
31433159 ext4_msg (sb , KERN_INFO , "mounted filesystem with%s. "
3144- "Opts: %s" , descr , orig_data );
3160+ "Opts: %s%s%s" , descr , sbi -> s_es -> s_mount_opts ,
3161+ * sbi -> s_es -> s_mount_opts ? "; " : "" , orig_data );
31453162
31463163 init_timer (& sbi -> s_err_report );
31473164 sbi -> s_err_report .function = print_daily_error_info ;
0 commit comments