Skip to contentSkip to conversation

always default to issue cache flushes

PATCH In review Christoph Hellwig 5 participants 10 messages Jul 11, 2011 – Jul 14, 2011 VFS

lore
Share & tools
lore
#0 lore raw

cover always default to issue cache flushes

It's bad enough that we still have filesystems who can't deal with the volatile write caches present on all modern consumer disks, but let's at least make use of this feature where present instead of playing fast and lose with users data. Switch ext3 and reiserfs to the same default already applied in btrfs, ext4, gfs2, hfsplus, nilfs2 and XFS.

#1 lore raw

PATCH 1/2 ext3: make ext3 mount default to barrier=1

From: Chris Mason <[email protected]>

This patch turns on barriers by default for ext3. mount -o barrier=0 will turn them off.

fs/ext3/super.c +2 -0
Index: linux-2.6/fs/ext3/super.c
===================================================================
@@ -1718,6 +1718,8 @@ static int ext3_fill_super (struct super
 	sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
 	sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
 
+	/* enable barriers by default */
+	set_opt(sbi->s_mount_opt, BARRIER);
 	set_opt(sbi->s_mount_opt, RESERVATION);
 
 	if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,
reviewer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] ext3: make ext3 mount default to barrier=1

Quoted 6 lines · Christoph Hellwig

From: Chris Mason <[email protected]>

This patch turns on barriers by default for ext3. mount -o barrier=0 will turn them off.

This patch misses signed-off-by. Feel free to add

Honza

Quoted 13 lines

Index: linux-2.6/fs/ext3/super.c
===================================================================

fs/ext3/super.c +2 -0
@@ -1718,6 +1718,8 @@ static int ext3_fill_super (struct super
 	sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
 	sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
 
+	/* enable barriers by default */
+	set_opt(sbi->s_mount_opt, BARRIER);
 	set_opt(sbi->s_mount_opt, RESERVATION);
 
 	if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#3 lore raw

Re: [PATCH 1/2] ext3: make ext3 mount default to barrier=1

Quoted 9 lines · Jan Kara
Quoted 6 lines · Christoph Hellwig

From: Chris Mason <[email protected]>

This patch turns on barriers by default for ext3. mount -o barrier=0 will turn them off.

This patch misses signed-off-by. Feel free to add

I took it from the SuSE tree where it didn't have one either. I hope Jeff can add one, but if not I think it's trivial enough to bother.

Acked-by on v1 1/2
#5 lore raw

Re: [PATCH 1/2] ext3: make ext3 mount default to barrier=1

In reply to Christoph Hellwig
Quoted 12 lines · Christoph Hellwig

From: Chris Mason <[email protected]>

This patch turns on barriers by default for ext3. mount -o barrier=0 will turn them off.

Index: linux-2.6/fs/ext3/super.c
===================================================================

fs/ext3/super.c static int ext3_fill_super (struct super · line 1725

Quoted 8 lines
fs/ext3/super.c +2 -0
@@ -1718,6 +1718,8 @@ static int ext3_fill_super (struct super
 	sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
 	sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
 
+	/* enable barriers by default */
+	set_opt(sbi->s_mount_opt, BARRIER);
 	set_opt(sbi->s_mount_opt, RESERVATION);
 
 	if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,

Thank you, I hope it will get upstream THIS time ;)

As Jan said, despite uptream rejection last time, RHEL6 and SuSE have made this change anyway, because it's the Right Thing To Do.

-Eric

#6 lore raw

Re: [PATCH 1/2] ext3: make ext3 mount default to barrier=1

In reply to Christoph Hellwig

Excerpts from Christoph Hellwig's message of 2011-07-11 14:25:59 -0400:

Quoted 2 lines

From: Chris Mason <[email protected]>

Thanks for digging this out, you can toss in a sob for me. Probably best to give yourself credit in the from:, since you went to all the trouble of diving in the vendor kernels.

Then again, if you're using the old email to try and throw Andrew off our trail, go for it.

-chris

Quoted 18 lines

This patch turns on barriers by default for ext3. mount -o barrier=0 will turn them off.

Index: linux-2.6/fs/ext3/super.c
===================================================================

fs/ext3/super.c 2011-07-02 13:56:51.877784292 +0200 renamed from fs/ext3/super.c 2011-06-30 21:19:37.389544975 +0200 +2 -0
@@ -1718,6 +1718,8 @@ static int ext3_fill_super (struct super
     sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
     sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
 
+    /* enable barriers by default */
+    set_opt(sbi->s_mount_opt, BARRIER);
     set_opt(sbi->s_mount_opt, RESERVATION);
 
     if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,
#7 lore raw

Re: [PATCH 1/2] ext3: make ext3 mount default to barrier=1

Quoted 10 lines · Chris Mason

Excerpts from Christoph Hellwig's message of 2011-07-11 14:25:59 -0400:

Quoted 2 lines

From: Chris Mason <[email protected]>

Thanks for digging this out, you can toss in a sob for me. Probably best to give yourself credit in the from:, since you went to all the trouble of diving in the vendor kernels.

Then again, if you're using the old email to try and throw Andrew off our trail, go for it.

Given that it's trivial one liners, and suse actually had config options around them that I had to remove I might as well claim the patches as mine. I'll resend them with my From and Signoff lines.

#8 lore raw

PATCH 2/2 reiserfs: make reiserfs default to barrier=flush

In reply to Christoph Hellwig

From: Jeff Mahoney <[email protected]>

Change the default reiserfs mount option to barrier=flush.

fs/reiserfs/super.c +1 -0
Index: linux-2.6/fs/reiserfs/super.c
===================================================================
@@ -1643,6 +1643,7 @@ static int reiserfs_fill_super(struct su
 	/* Set default values for options: non-aggressive tails, RO on errors */
 	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);
 	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO);
+	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_BARRIER_FLUSH);
 	/* no preallocation minimum, be smart in
 	   reiserfs_file_write instead */
 	REISERFS_SB(s)->s_alloc_options.preallocmin = 0;
reviewer
#9 lore raw
In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig

It's bad enough that we still have filesystems who can't deal with the volatile write caches present on all modern consumer disks, but let's at least make use of this feature where present instead of playing fast and lose with users data. Switch ext3 and reiserfs to the same default already applied in btrfs, ext4, gfs2, hfsplus, nilfs2 and XFS.

Maybe it's worth noting that both RH and SUSE distributions actually have
barriers switched on by default for years so this change isn't going to affect most enterprise users.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR