linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Set barrier=0 when block device does not advertise flush support
@ 2010-12-03  0:16 Darrick J. Wong
  2010-12-03  7:09 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2010-12-03  0:16 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-kernel, linux-ext4

If the user tries to enable write flushes with "barrier=1" and the underlying
block device does not support flushes, print a message and set barrier=0.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 fs/ext4/super.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e32195d..098dcf0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3124,6 +3124,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 			   &journal_ioprio, NULL, 0))
 		goto failed_mount;
 
+	/* Catch barrier=1 and no flush support */
+	if (test_opt(sb, BARRIER) &&
+		     !(sb->s_bdev->bd_disk->queue->flush_flags & REQ_FLUSH)) {
+		ext4_msg(sb, KERN_WARNING, "flush not supported; disabling.");
+		clear_opt(sbi->s_mount_opt, BARRIER);
+	}
+
 	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
 		(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
 
@@ -4198,6 +4205,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 		goto restore_opts;
 	}
 
+	/* Catch barrier=1 and no flush support */
+	if (test_opt(sb, BARRIER) &&
+		     !(sb->s_bdev->bd_disk->queue->flush_flags & REQ_FLUSH)) {
+		ext4_msg(sb, KERN_WARNING, "flush not supported; disabling.");
+		clear_opt(sbi->s_mount_opt, BARRIER);
+	}
+
 	if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
 		ext4_abort(sb, "Abort forced by user");
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: Set barrier=0 when block device does not advertise flush support
  2010-12-03  0:16 [PATCH] ext4: Set barrier=0 when block device does not advertise flush support Darrick J. Wong
@ 2010-12-03  7:09 ` Christoph Hellwig
  2010-12-03  9:14   ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2010-12-03  7:09 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Theodore Ts'o, linux-kernel, linux-ext4

On Thu, Dec 02, 2010 at 04:16:59PM -0800, Darrick J. Wong wrote:
> If the user tries to enable write flushes with "barrier=1" and the underlying
> block device does not support flushes, print a message and set barrier=0.

That doesn't make any sense at all with the ne wFLUSH+FUA code, which is
designed to make the cache flushing entirely transparanent.  Basically
with the new code the barrier option should become a no-op and always
enabled.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: Set barrier=0 when block device does not advertise flush support
  2010-12-03  7:09 ` Christoph Hellwig
@ 2010-12-03  9:14   ` Darrick J. Wong
  2010-12-06 13:39     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2010-12-03  9:14 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Theodore Ts'o, linux-kernel, linux-ext4

On Fri, Dec 03, 2010 at 02:09:50AM -0500, Christoph Hellwig wrote:
> On Thu, Dec 02, 2010 at 04:16:59PM -0800, Darrick J. Wong wrote:
> > If the user tries to enable write flushes with "barrier=1" and the underlying
> > block device does not support flushes, print a message and set barrier=0.
> 
> That doesn't make any sense at all with the ne wFLUSH+FUA code, which is
> designed to make the cache flushing entirely transparanent.  Basically
> with the new code the barrier option should become a no-op and always
> enabled.

Are we ready to remove the barrier= mount option at this point?  How many users
exist who use barrier=0 to speed up write performance when they're willing to
take on the added safety risk?

I've noticed that provisioning goes faster if one mounts the filesystem with
barrier=0; so long as the control software turns barriers on after the deploy
finishes and always restarts the deploy after a failure, a power failure on the
client system won't cause problems.  Unfortunately, there doesn't seem to be
any other way to communicate that relaxation to the code.

Personally I'd rather the knob remain in ext4 on the grounds that I know my
workloads and can judge the appropriate level of risk, especially since ext4
picks the safe option by default.  However, I'd prefer /proc/mounts not
misrepresent the status of flush support, to the best of ext4's knowledge.

--D

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: Set barrier=0 when block device does not advertise flush support
  2010-12-03  9:14   ` Darrick J. Wong
@ 2010-12-06 13:39     ` Christoph Hellwig
  2010-12-06 18:09       ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2010-12-06 13:39 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Christoph Hellwig, Theodore Ts'o, linux-kernel, linux-ext4

barrier=0 really means losemydata=1.  The plan I discussed with Jens was
to allow to disable the flush and fua semantics in the block layer, so
we'll have one new tunable for that, which is documented to causes these
issues.  

> picks the safe option by default.  However, I'd prefer /proc/mounts not
> misrepresent the status of flush support, to the best of ext4's knowledge.

That's bullshit.  The barrier option has traditionally meant that we
sent barrier requests, and now means thatwe send flush+fua requests.
There's no reason for a warning and option mislabling just because you
got the most efficient implementation of it.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: Set barrier=0 when block device does not advertise flush support
  2010-12-06 13:39     ` Christoph Hellwig
@ 2010-12-06 18:09       ` Darrick J. Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2010-12-06 18:09 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Theodore Ts'o, linux-kernel, linux-ext4

On Mon, Dec 06, 2010 at 08:39:24AM -0500, Christoph Hellwig wrote:
> barrier=0 really means losemydata=1.  The plan I discussed with Jens was
> to allow to disable the flush and fua semantics in the block layer, so
> we'll have one new tunable for that, which is documented to causes these
> issues.  

Oh.  I wasn't aware that anyone was planning to put in a tuning knob for
flush/fua, red warning light or otherwise.  What is the name of the tunable,
and when will it appear?  Or has it already?

> > picks the safe option by default.  However, I'd prefer /proc/mounts not
> > misrepresent the status of flush support, to the best of ext4's knowledge.
> 
> That's bullshit.  The barrier option has traditionally meant that we

Well then, let's remove the barrier= mount flag altogether.  No need for strong
language over a minor issue. :)  When I see some patches I will push this
through my testing setup and report back what data I collect.

--D

> sent barrier requests, and now means thatwe send flush+fua requests.
> There's no reason for a warning and option mislabling just because you
> got the most efficient implementation of it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-06 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-03  0:16 [PATCH] ext4: Set barrier=0 when block device does not advertise flush support Darrick J. Wong
2010-12-03  7:09 ` Christoph Hellwig
2010-12-03  9:14   ` Darrick J. Wong
2010-12-06 13:39     ` Christoph Hellwig
2010-12-06 18:09       ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).