aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-03-28 10:59:57 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-03-28 10:59:57 -0400
commit06705bff9114531a997a7d0c2520bea0f2927410 (patch)
treef7bef499cd491c8171db45da5b02c168655d4236
parente7c9e3e99adf6c49c5d593a51375916acc039d1e (diff)
ext4: Regularize mount options
Add support for using the mount options "barrier" and "nobarrier", and "auto_da_alloc" and "noauto_da_alloc", which is more consistent than "barrier=<0|1>" or "auto_da_alloc=<0|1>". Most other ext3/ext4 mount options use the foo/nofoo naming convention. We allow the old forms of these mount options for backwards compatibility. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--Documentation/filesystems/ext4.txt25
-rw-r--r--fs/ext4/super.c30
2 files changed, 45 insertions, 10 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 5c484aec2bab..97882df04865 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -183,8 +183,8 @@ commit=nrsec (*) Ext4 can be told to sync all its data and metadata
183 performance. 183 performance.
184 184
185barrier=<0|1(*)> This enables/disables the use of write barriers in 185barrier=<0|1(*)> This enables/disables the use of write barriers in
186 the jbd code. barrier=0 disables, barrier=1 enables. 186barrier(*) the jbd code. barrier=0 disables, barrier=1 enables.
187 This also requires an IO stack which can support 187nobarrier This also requires an IO stack which can support
188 barriers, and if jbd gets an error on a barrier 188 barriers, and if jbd gets an error on a barrier
189 write, it will disable again with a warning. 189 write, it will disable again with a warning.
190 Write barriers enforce proper on-disk ordering 190 Write barriers enforce proper on-disk ordering
@@ -192,6 +192,9 @@ barrier=<0|1(*)> This enables/disables the use of write barriers in
192 safe to use, at some performance penalty. If 192 safe to use, at some performance penalty. If
193 your disks are battery-backed in one way or another, 193 your disks are battery-backed in one way or another,
194 disabling barriers may safely improve performance. 194 disabling barriers may safely improve performance.
195 The mount options "barrier" and "nobarrier" can
196 also be used to enable or disable barriers, for
197 consistency with other ext4 mount options.
195 198
196inode_readahead=n This tuning parameter controls the maximum 199inode_readahead=n This tuning parameter controls the maximum
197 number of inode table blocks that ext4's inode 200 number of inode table blocks that ext4's inode
@@ -313,6 +316,24 @@ journal_ioprio=prio The I/O priority (from 0 to 7, where 0 is the
313 a slightly higher priority than the default I/O 316 a slightly higher priority than the default I/O
314 priority. 317 priority.
315 318
319auto_da_alloc(*) Many broken applications don't use fsync() when
320noauto_da_alloc replacing existing files via patterns such as
321 fd = open("foo.new")/write(fd,..)/close(fd)/
322 rename("foo.new", "foo"), or worse yet,
323 fd = open("foo", O_TRUNC)/write(fd,..)/close(fd).
324 If auto_da_alloc is enabled, ext4 will detect
325 the replace-via-rename and replace-via-truncate
326 patterns and force that any delayed allocation
327 blocks are allocated such that at the next
328 journal commit, in the default data=ordered
329 mode, the data blocks of the new file are forced
330 to disk before the rename() operation is
331 commited. This provides roughly the same level
332 of guarantees as ext3, and avoids the
333 "zero-length" problem that can happen when a
334 system crashes before the delayed allocation
335 blocks are forced to disk.
336
316Data Mode 337Data Mode
317========= 338=========
318There are 3 different data modes: 339There are 3 different data modes:
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 45d07cf9df34..9987bba99db3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -867,7 +867,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
867 seq_puts(seq, ",data_err=abort"); 867 seq_puts(seq, ",data_err=abort");
868 868
869 if (test_opt(sb, NO_AUTO_DA_ALLOC)) 869 if (test_opt(sb, NO_AUTO_DA_ALLOC))
870 seq_puts(seq, ",auto_da_alloc=0"); 870 seq_puts(seq, ",noauto_da_alloc");
871 871
872 ext4_show_quota_options(seq, sb); 872 ext4_show_quota_options(seq, sb);
873 return 0; 873 return 0;
@@ -1018,7 +1018,7 @@ enum {
1018 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, 1018 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro,
1019 Opt_nouid32, Opt_debug, Opt_oldalloc, Opt_orlov, 1019 Opt_nouid32, Opt_debug, Opt_oldalloc, Opt_orlov,
1020 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, 1020 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
1021 Opt_auto_da_alloc, Opt_noload, Opt_nobh, Opt_bh, 1021 Opt_auto_da_alloc, Opt_noauto_da_alloc, Opt_noload, Opt_nobh, Opt_bh,
1022 Opt_commit, Opt_min_batch_time, Opt_max_batch_time, 1022 Opt_commit, Opt_min_batch_time, Opt_max_batch_time,
1023 Opt_journal_update, Opt_journal_dev, 1023 Opt_journal_update, Opt_journal_dev,
1024 Opt_journal_checksum, Opt_journal_async_commit, 1024 Opt_journal_checksum, Opt_journal_async_commit,
@@ -1026,8 +1026,8 @@ enum {
1026 Opt_data_err_abort, Opt_data_err_ignore, 1026 Opt_data_err_abort, Opt_data_err_ignore,
1027 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, 1027 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
1028 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, 1028 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
1029 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, 1029 Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err, Opt_resize,
1030 Opt_grpquota, Opt_i_version, 1030 Opt_usrquota, Opt_grpquota, Opt_i_version,
1031 Opt_stripe, Opt_delalloc, Opt_nodelalloc, 1031 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
1032 Opt_inode_readahead_blks, Opt_journal_ioprio 1032 Opt_inode_readahead_blks, Opt_journal_ioprio
1033}; 1033};
@@ -1080,6 +1080,8 @@ static const match_table_t tokens = {
1080 {Opt_quota, "quota"}, 1080 {Opt_quota, "quota"},
1081 {Opt_usrquota, "usrquota"}, 1081 {Opt_usrquota, "usrquota"},
1082 {Opt_barrier, "barrier=%u"}, 1082 {Opt_barrier, "barrier=%u"},
1083 {Opt_barrier, "barrier"},
1084 {Opt_nobarrier, "nobarrier"},
1083 {Opt_i_version, "i_version"}, 1085 {Opt_i_version, "i_version"},
1084 {Opt_stripe, "stripe=%u"}, 1086 {Opt_stripe, "stripe=%u"},
1085 {Opt_resize, "resize"}, 1087 {Opt_resize, "resize"},
@@ -1088,6 +1090,8 @@ static const match_table_t tokens = {
1088 {Opt_inode_readahead_blks, "inode_readahead_blks=%u"}, 1090 {Opt_inode_readahead_blks, "inode_readahead_blks=%u"},
1089 {Opt_journal_ioprio, "journal_ioprio=%u"}, 1091 {Opt_journal_ioprio, "journal_ioprio=%u"},
1090 {Opt_auto_da_alloc, "auto_da_alloc=%u"}, 1092 {Opt_auto_da_alloc, "auto_da_alloc=%u"},
1093 {Opt_auto_da_alloc, "auto_da_alloc"},
1094 {Opt_noauto_da_alloc, "noauto_da_alloc"},
1091 {Opt_err, NULL}, 1095 {Opt_err, NULL},
1092}; 1096};
1093 1097
@@ -1422,9 +1426,14 @@ set_qf_format:
1422 case Opt_abort: 1426 case Opt_abort:
1423 set_opt(sbi->s_mount_opt, ABORT); 1427 set_opt(sbi->s_mount_opt, ABORT);
1424 break; 1428 break;
1429 case Opt_nobarrier:
1430 clear_opt(sbi->s_mount_opt, BARRIER);
1431 break;
1425 case Opt_barrier: 1432 case Opt_barrier:
1426 if (match_int(&args[0], &option)) 1433 if (match_int(&args[0], &option)) {
1427 return 0; 1434 set_opt(sbi->s_mount_opt, BARRIER);
1435 break;
1436 }
1428 if (option) 1437 if (option)
1429 set_opt(sbi->s_mount_opt, BARRIER); 1438 set_opt(sbi->s_mount_opt, BARRIER);
1430 else 1439 else
@@ -1485,9 +1494,14 @@ set_qf_format:
1485 *journal_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 1494 *journal_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE,
1486 option); 1495 option);
1487 break; 1496 break;
1497 case Opt_noauto_da_alloc:
1498 set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC);
1499 break;
1488 case Opt_auto_da_alloc: 1500 case Opt_auto_da_alloc:
1489 if (match_int(&args[0], &option)) 1501 if (match_int(&args[0], &option)) {
1490 return 0; 1502 clear_opt(sbi->s_mount_opt, NO_AUTO_DA_ALLOC);
1503 break;
1504 }
1491 if (option) 1505 if (option)
1492 clear_opt(sbi->s_mount_opt, NO_AUTO_DA_ALLOC); 1506 clear_opt(sbi->s_mount_opt, NO_AUTO_DA_ALLOC);
1493 else 1507 else