diff options
author | Eric Sandeen <sandeen@redhat.com> | 2008-05-26 12:29:46 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-05-26 12:29:46 -0400 |
commit | 571640cad3fda6475da45d91cf86076f1f86bd9b (patch) | |
tree | a97ff3da9b60251c68358cd000c217cb37915ea2 | |
parent | 034772b068be62a79470d6c1b81b01fbe27793ac (diff) |
ext4: enable barriers by default
I can't think of any valid reason for ext4 to not use barriers when
they are available; I believe this is necessary for filesystem
integrity in the face of a volatile write cache on storage.
An administrator who trusts that the cache is sufficiently battery-
backed (and power supplies are sufficiently redundant, etc...)
can always turn it back off again.
SuSE has carried such a patch for ext3 for quite some time now.
Also document the mount option while we're at it.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | Documentation/filesystems/ext4.txt | 12 | ||||
-rw-r--r-- | fs/ext4/super.c | 11 |
2 files changed, 19 insertions, 4 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index 560f88dc7090..0c5086db8352 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -139,8 +139,16 @@ commit=nrsec (*) Ext4 can be told to sync all its data and metadata | |||
139 | Setting it to very large values will improve | 139 | Setting it to very large values will improve |
140 | performance. | 140 | performance. |
141 | 141 | ||
142 | barrier=1 This enables/disables barriers. barrier=0 disables | 142 | barrier=<0|1(*)> This enables/disables the use of write barriers in |
143 | it, barrier=1 enables it. | 143 | the jbd code. barrier=0 disables, barrier=1 enables. |
144 | This also requires an IO stack which can support | ||
145 | barriers, and if jbd gets an error on a barrier | ||
146 | write, it will disable again with a warning. | ||
147 | Write barriers enforce proper on-disk ordering | ||
148 | of journal commits, making volatile disk write caches | ||
149 | safe to use, at some performance penalty. If | ||
150 | your disks are battery-backed in one way or another, | ||
151 | disabling barriers may safely improve performance. | ||
144 | 152 | ||
145 | orlov (*) This enables the new Orlov block allocator. It is | 153 | orlov (*) This enables the new Orlov block allocator. It is |
146 | enabled by default. | 154 | enabled by default. |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ba92c606ad9a..cb96f127c366 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -671,6 +671,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
671 | unsigned long def_mount_opts; | 671 | unsigned long def_mount_opts; |
672 | struct super_block *sb = vfs->mnt_sb; | 672 | struct super_block *sb = vfs->mnt_sb; |
673 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 673 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
674 | journal_t *journal = sbi->s_journal; | ||
674 | struct ext4_super_block *es = sbi->s_es; | 675 | struct ext4_super_block *es = sbi->s_es; |
675 | 676 | ||
676 | def_mount_opts = le32_to_cpu(es->s_default_mount_opts); | 677 | def_mount_opts = le32_to_cpu(es->s_default_mount_opts); |
@@ -729,8 +730,13 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
729 | seq_printf(seq, ",commit=%u", | 730 | seq_printf(seq, ",commit=%u", |
730 | (unsigned) (sbi->s_commit_interval / HZ)); | 731 | (unsigned) (sbi->s_commit_interval / HZ)); |
731 | } | 732 | } |
732 | if (test_opt(sb, BARRIER)) | 733 | /* |
733 | seq_puts(seq, ",barrier=1"); | 734 | * We're changing the default of barrier mount option, so |
735 | * let's always display its mount state so it's clear what its | ||
736 | * status is. | ||
737 | */ | ||
738 | seq_puts(seq, ",barrier="); | ||
739 | seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); | ||
734 | if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) | 740 | if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) |
735 | seq_puts(seq, ",journal_async_commit"); | 741 | seq_puts(seq, ",journal_async_commit"); |
736 | if (test_opt(sb, NOBH)) | 742 | if (test_opt(sb, NOBH)) |
@@ -1909,6 +1915,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1909 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); | 1915 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); |
1910 | 1916 | ||
1911 | set_opt(sbi->s_mount_opt, RESERVATION); | 1917 | set_opt(sbi->s_mount_opt, RESERVATION); |
1918 | set_opt(sbi->s_mount_opt, BARRIER); | ||
1912 | 1919 | ||
1913 | /* | 1920 | /* |
1914 | * turn on extents feature by default in ext4 filesystem | 1921 | * turn on extents feature by default in ext4 filesystem |