diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-08-01 23:14:20 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-08-01 23:14:20 -0400 |
commit | 8b67f04ab9de5d8f3a71aef72bf02c995a506db5 (patch) | |
tree | dd05968730762f5b18de4c6b0720843669e4e9db /fs/ext4/super.c | |
parent | ca0e05e4b15193aeba72b995e90de990db7f8304 (diff) |
ext4: Add mount options in superblock
Allow mount options to be stored in the superblock. Also add default
mount option bits for nobarrier, block_validity, discard, and nodelalloc.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3e3f6484c223..3fd65eb66ccd 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1003,10 +1003,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
1003 | seq_puts(seq, ",journal_checksum"); | 1003 | seq_puts(seq, ",journal_checksum"); |
1004 | if (test_opt(sb, I_VERSION)) | 1004 | if (test_opt(sb, I_VERSION)) |
1005 | seq_puts(seq, ",i_version"); | 1005 | seq_puts(seq, ",i_version"); |
1006 | if (!test_opt(sb, DELALLOC)) | 1006 | if (!test_opt(sb, DELALLOC) && |
1007 | !(def_mount_opts & EXT4_DEFM_NODELALLOC)) | ||
1007 | seq_puts(seq, ",nodelalloc"); | 1008 | seq_puts(seq, ",nodelalloc"); |
1008 | 1009 | ||
1009 | |||
1010 | if (sbi->s_stripe) | 1010 | if (sbi->s_stripe) |
1011 | seq_printf(seq, ",stripe=%lu", sbi->s_stripe); | 1011 | seq_printf(seq, ",stripe=%lu", sbi->s_stripe); |
1012 | /* | 1012 | /* |
@@ -1030,7 +1030,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
1030 | if (test_opt(sb, NO_AUTO_DA_ALLOC)) | 1030 | if (test_opt(sb, NO_AUTO_DA_ALLOC)) |
1031 | seq_puts(seq, ",noauto_da_alloc"); | 1031 | seq_puts(seq, ",noauto_da_alloc"); |
1032 | 1032 | ||
1033 | if (test_opt(sb, DISCARD)) | 1033 | if (test_opt(sb, DISCARD) && !(def_mount_opts & EXT4_DEFM_DISCARD)) |
1034 | seq_puts(seq, ",discard"); | 1034 | seq_puts(seq, ",discard"); |
1035 | 1035 | ||
1036 | if (test_opt(sb, NOLOAD)) | 1036 | if (test_opt(sb, NOLOAD)) |
@@ -1039,6 +1039,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
1039 | if (test_opt(sb, DIOREAD_NOLOCK)) | 1039 | if (test_opt(sb, DIOREAD_NOLOCK)) |
1040 | seq_puts(seq, ",dioread_nolock"); | 1040 | seq_puts(seq, ",dioread_nolock"); |
1041 | 1041 | ||
1042 | if (test_opt(sb, BLOCK_VALIDITY) && | ||
1043 | !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY)) | ||
1044 | seq_puts(seq, ",block_validity"); | ||
1045 | |||
1042 | ext4_show_quota_options(seq, sb); | 1046 | ext4_show_quota_options(seq, sb); |
1043 | 1047 | ||
1044 | return 0; | 1048 | return 0; |
@@ -2655,6 +2659,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2655 | set_opt(sbi->s_mount_opt, ERRORS_CONT); | 2659 | set_opt(sbi->s_mount_opt, ERRORS_CONT); |
2656 | else | 2660 | else |
2657 | set_opt(sbi->s_mount_opt, ERRORS_RO); | 2661 | 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); | ||
2658 | 2666 | ||
2659 | sbi->s_resuid = le16_to_cpu(es->s_def_resuid); | 2667 | sbi->s_resuid = le16_to_cpu(es->s_def_resuid); |
2660 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); | 2668 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); |
@@ -2662,15 +2670,23 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2662 | sbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME; | 2670 | sbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME; |
2663 | sbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME; | 2671 | sbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME; |
2664 | 2672 | ||
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); | ||
2666 | 2675 | ||
2667 | /* | 2676 | /* |
2668 | * enable delayed allocation by default | 2677 | * enable delayed allocation by default |
2669 | * Use -o nodelalloc to turn it off | 2678 | * Use -o nodelalloc to turn it off |
2670 | */ | 2679 | */ |
2671 | if (!IS_EXT3_SB(sb)) | 2680 | if (!IS_EXT3_SB(sb) && |
2681 | ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0)) | ||
2672 | set_opt(sbi->s_mount_opt, DELALLOC); | 2682 | set_opt(sbi->s_mount_opt, DELALLOC); |
2673 | 2683 | ||
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 | } | ||
2674 | if (!parse_options((char *) data, sb, &journal_devnum, | 2690 | if (!parse_options((char *) data, sb, &journal_devnum, |
2675 | &journal_ioprio, NULL, 0)) | 2691 | &journal_ioprio, NULL, 0)) |
2676 | goto failed_mount; | 2692 | goto failed_mount; |
@@ -3141,7 +3157,8 @@ no_journal: | |||
3141 | descr = "out journal"; | 3157 | descr = "out journal"; |
3142 | 3158 | ||
3143 | ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " | 3159 | 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); | ||
3145 | 3162 | ||
3146 | init_timer(&sbi->s_err_report); | 3163 | init_timer(&sbi->s_err_report); |
3147 | sbi->s_err_report.function = print_daily_error_info; | 3164 | sbi->s_err_report.function = print_daily_error_info; |