diff options
| -rw-r--r-- | fs/ext3/Kconfig | 32 | ||||
| -rw-r--r-- | fs/ext3/super.c | 40 |
2 files changed, 44 insertions, 28 deletions
diff --git a/fs/ext3/Kconfig b/fs/ext3/Kconfig index fb3c1a21b135..522b15498f45 100644 --- a/fs/ext3/Kconfig +++ b/fs/ext3/Kconfig | |||
| @@ -29,23 +29,25 @@ config EXT3_FS | |||
| 29 | module will be called ext3. | 29 | module will be called ext3. |
| 30 | 30 | ||
| 31 | config EXT3_DEFAULTS_TO_ORDERED | 31 | config EXT3_DEFAULTS_TO_ORDERED |
| 32 | bool "Default to 'data=ordered' in ext3 (legacy option)" | 32 | bool "Default to 'data=ordered' in ext3" |
| 33 | depends on EXT3_FS | 33 | depends on EXT3_FS |
| 34 | help | 34 | help |
| 35 | If a filesystem does not explicitly specify a data ordering | 35 | The journal mode options for ext3 have different tradeoffs |
| 36 | mode, and the journal capability allowed it, ext3 used to | 36 | between when data is guaranteed to be on disk and |
| 37 | historically default to 'data=ordered'. | 37 | performance. The use of "data=writeback" can cause |
| 38 | 38 | unwritten data to appear in files after an system crash or | |
| 39 | That was a rather unfortunate choice, because it leads to all | 39 | power failure, which can be a security issue. However, |
| 40 | kinds of latency problems, and the 'data=writeback' mode is more | 40 | "data=ordered" mode can also result in major performance |
| 41 | appropriate these days. | 41 | problems, including seconds-long delays before an fsync() |
| 42 | 42 | call returns. For details, see: | |
| 43 | You should probably always answer 'n' here, and if you really | 43 | |
| 44 | want to use 'data=ordered' mode, set it in the filesystem itself | 44 | http://ext4.wiki.kernel.org/index.php/Ext3_data_mode_tradeoffs |
| 45 | with 'tune2fs -o journal_data_ordered'. | 45 | |
| 46 | 46 | If you have been historically happy with ext3's performance, | |
| 47 | But if you really want to enable the legacy default, you can do | 47 | data=ordered mode will be a safe choice and you should |
| 48 | so by answering 'y' to this question. | 48 | answer 'y' here. If you understand the reliability and data |
| 49 | privacy issues of data=writeback and are willing to make | ||
| 50 | that trade off, answer 'n'. | ||
| 49 | 51 | ||
| 50 | config EXT3_FS_XATTR | 52 | config EXT3_FS_XATTR |
| 51 | bool "Ext3 extended attributes" | 53 | bool "Ext3 extended attributes" |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 524b349c6299..a8d80a7f1105 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
| @@ -543,6 +543,19 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl | |||
| 543 | #endif | 543 | #endif |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | static char *data_mode_string(unsigned long mode) | ||
| 547 | { | ||
| 548 | switch (mode) { | ||
| 549 | case EXT3_MOUNT_JOURNAL_DATA: | ||
| 550 | return "journal"; | ||
| 551 | case EXT3_MOUNT_ORDERED_DATA: | ||
| 552 | return "ordered"; | ||
| 553 | case EXT3_MOUNT_WRITEBACK_DATA: | ||
| 554 | return "writeback"; | ||
| 555 | } | ||
| 556 | return "unknown"; | ||
| 557 | } | ||
| 558 | |||
| 546 | /* | 559 | /* |
| 547 | * Show an option if | 560 | * Show an option if |
| 548 | * - it's set to a non-default value OR | 561 | * - it's set to a non-default value OR |
| @@ -616,13 +629,8 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
| 616 | if (test_opt(sb, NOBH)) | 629 | if (test_opt(sb, NOBH)) |
| 617 | seq_puts(seq, ",nobh"); | 630 | seq_puts(seq, ",nobh"); |
| 618 | 631 | ||
| 619 | if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | 632 | seq_printf(seq, ",data=%s", data_mode_string(sbi->s_mount_opt & |
| 620 | seq_puts(seq, ",data=journal"); | 633 | EXT3_MOUNT_DATA_FLAGS)); |
| 621 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
| 622 | seq_puts(seq, ",data=ordered"); | ||
| 623 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
| 624 | seq_puts(seq, ",data=writeback"); | ||
| 625 | |||
| 626 | if (test_opt(sb, DATA_ERR_ABORT)) | 634 | if (test_opt(sb, DATA_ERR_ABORT)) |
| 627 | seq_puts(seq, ",data_err=abort"); | 635 | seq_puts(seq, ",data_err=abort"); |
| 628 | 636 | ||
| @@ -1024,12 +1032,18 @@ static int parse_options (char *options, struct super_block *sb, | |||
| 1024 | datacheck: | 1032 | datacheck: |
| 1025 | if (is_remount) { | 1033 | if (is_remount) { |
| 1026 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) | 1034 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) |
| 1027 | != data_opt) { | 1035 | == data_opt) |
| 1028 | printk(KERN_ERR | 1036 | break; |
| 1029 | "EXT3-fs: cannot change data " | 1037 | printk(KERN_ERR |
| 1030 | "mode on remount\n"); | 1038 | "EXT3-fs (device %s): Cannot change " |
| 1031 | return 0; | 1039 | "data mode on remount. The filesystem " |
| 1032 | } | 1040 | "is mounted in data=%s mode and you " |
| 1041 | "try to remount it in data=%s mode.\n", | ||
| 1042 | sb->s_id, | ||
| 1043 | data_mode_string(sbi->s_mount_opt & | ||
| 1044 | EXT3_MOUNT_DATA_FLAGS), | ||
| 1045 | data_mode_string(data_opt)); | ||
| 1046 | return 0; | ||
| 1033 | } else { | 1047 | } else { |
| 1034 | sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS; | 1048 | sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS; |
| 1035 | sbi->s_mount_opt |= data_opt; | 1049 | sbi->s_mount_opt |= data_opt; |
