diff options
-rw-r--r-- | Documentation/filesystems/ext3.txt | 15 | ||||
-rw-r--r-- | fs/ext3/super.c | 33 |
2 files changed, 39 insertions, 9 deletions
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index 867c5b50cb4..272f80d5f96 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -59,8 +59,19 @@ commit=nrsec (*) Ext3 can be told to sync all its data and metadata | |||
59 | Setting it to very large values will improve | 59 | Setting it to very large values will improve |
60 | performance. | 60 | performance. |
61 | 61 | ||
62 | barrier=1 This enables/disables barriers. barrier=0 disables | 62 | barrier=<0(*)|1> This enables/disables the use of write barriers in |
63 | it, barrier=1 enables it. | 63 | barrier the jbd code. barrier=0 disables, barrier=1 enables. |
64 | nobarrier (*) This also requires an IO stack which can support | ||
65 | barriers, and if jbd gets an error on a barrier | ||
66 | write, it will disable again with a warning. | ||
67 | Write barriers enforce proper on-disk ordering | ||
68 | of journal commits, making volatile disk write caches | ||
69 | safe to use, at some performance penalty. If | ||
70 | your disks are battery-backed in one way or another, | ||
71 | disabling barriers may safely improve performance. | ||
72 | The mount options "barrier" and "nobarrier" can | ||
73 | also be used to enable or disable barriers, for | ||
74 | consistency with other ext3 mount options. | ||
64 | 75 | ||
65 | orlov (*) This enables the new Orlov block allocator. It is | 76 | orlov (*) This enables the new Orlov block allocator. It is |
66 | enabled by default. | 77 | enabled by default. |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 6b6e49de091..0fc1293d0e9 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -653,8 +653,12 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
653 | seq_printf(seq, ",commit=%u", | 653 | seq_printf(seq, ",commit=%u", |
654 | (unsigned) (sbi->s_commit_interval / HZ)); | 654 | (unsigned) (sbi->s_commit_interval / HZ)); |
655 | } | 655 | } |
656 | if (test_opt(sb, BARRIER)) | 656 | |
657 | seq_puts(seq, ",barrier=1"); | 657 | /* |
658 | * Always display barrier state so it's clear what the status is. | ||
659 | */ | ||
660 | seq_puts(seq, ",barrier="); | ||
661 | seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); | ||
658 | if (test_opt(sb, NOBH)) | 662 | if (test_opt(sb, NOBH)) |
659 | seq_puts(seq, ",nobh"); | 663 | seq_puts(seq, ",nobh"); |
660 | 664 | ||
@@ -810,8 +814,8 @@ enum { | |||
810 | Opt_data_err_abort, Opt_data_err_ignore, | 814 | Opt_data_err_abort, Opt_data_err_ignore, |
811 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, | 815 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, |
812 | Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota, | 816 | Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota, |
813 | Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize, | 817 | Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err, |
814 | Opt_usrquota, Opt_grpquota | 818 | Opt_resize, Opt_usrquota, Opt_grpquota |
815 | }; | 819 | }; |
816 | 820 | ||
817 | static const match_table_t tokens = { | 821 | static const match_table_t tokens = { |
@@ -865,6 +869,8 @@ static const match_table_t tokens = { | |||
865 | {Opt_quota, "quota"}, | 869 | {Opt_quota, "quota"}, |
866 | {Opt_usrquota, "usrquota"}, | 870 | {Opt_usrquota, "usrquota"}, |
867 | {Opt_barrier, "barrier=%u"}, | 871 | {Opt_barrier, "barrier=%u"}, |
872 | {Opt_barrier, "barrier"}, | ||
873 | {Opt_nobarrier, "nobarrier"}, | ||
868 | {Opt_resize, "resize"}, | 874 | {Opt_resize, "resize"}, |
869 | {Opt_err, NULL}, | 875 | {Opt_err, NULL}, |
870 | }; | 876 | }; |
@@ -967,7 +973,11 @@ static int parse_options (char *options, struct super_block *sb, | |||
967 | int token; | 973 | int token; |
968 | if (!*p) | 974 | if (!*p) |
969 | continue; | 975 | continue; |
970 | 976 | /* | |
977 | * Initialize args struct so we know whether arg was | ||
978 | * found; some options take optional arguments. | ||
979 | */ | ||
980 | args[0].to = args[0].from = 0; | ||
971 | token = match_token(p, tokens, args); | 981 | token = match_token(p, tokens, args); |
972 | switch (token) { | 982 | switch (token) { |
973 | case Opt_bsd_df: | 983 | case Opt_bsd_df: |
@@ -1215,9 +1225,15 @@ set_qf_format: | |||
1215 | case Opt_abort: | 1225 | case Opt_abort: |
1216 | set_opt(sbi->s_mount_opt, ABORT); | 1226 | set_opt(sbi->s_mount_opt, ABORT); |
1217 | break; | 1227 | break; |
1228 | case Opt_nobarrier: | ||
1229 | clear_opt(sbi->s_mount_opt, BARRIER); | ||
1230 | break; | ||
1218 | case Opt_barrier: | 1231 | case Opt_barrier: |
1219 | if (match_int(&args[0], &option)) | 1232 | if (args[0].from) { |
1220 | return 0; | 1233 | if (match_int(&args[0], &option)) |
1234 | return 0; | ||
1235 | } else | ||
1236 | option = 1; /* No argument, default to 1 */ | ||
1221 | if (option) | 1237 | if (option) |
1222 | set_opt(sbi->s_mount_opt, BARRIER); | 1238 | set_opt(sbi->s_mount_opt, BARRIER); |
1223 | else | 1239 | else |
@@ -2276,6 +2292,9 @@ static int ext3_load_journal(struct super_block *sb, | |||
2276 | return -EINVAL; | 2292 | return -EINVAL; |
2277 | } | 2293 | } |
2278 | 2294 | ||
2295 | if (!(journal->j_flags & JFS_BARRIER)) | ||
2296 | printk(KERN_INFO "EXT3-fs: barriers not enabled\n"); | ||
2297 | |||
2279 | if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { | 2298 | if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { |
2280 | err = journal_update_format(journal); | 2299 | err = journal_update_format(journal); |
2281 | if (err) { | 2300 | if (err) { |