From: Jeff Mahoney <jeffm@suse.com>
Subject: Make reiserfs default to barrier=flush
Patch-mainline: v3.1-rc1
Git-commit: b4d5b10fb2e3a4327838c07d8ebd9e350fcc133d
X-Commit-Note: Upstrean version drops kconfig

Change the default reiserfs mount option to barrier=flush

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---

 fs/reiserfs/Kconfig |   22 ++++++++++++++++++++++
 fs/reiserfs/super.c |    3 +++
 2 files changed, 25 insertions(+)

Index: linux-3.0-tmp-jikos/fs/reiserfs/Kconfig
===================================================================
--- linux-3.0-tmp-jikos.orig/fs/reiserfs/Kconfig
+++ linux-3.0-tmp-jikos/fs/reiserfs/Kconfig
@@ -52,6 +52,28 @@ config REISERFS_PROC_INFO
 	  Almost everyone but ReiserFS developers and people fine-tuning
 	  reiserfs or tracing problems should say N.
 
+config REISERFS_DEFAULTS_TO_BARRIERS_ENABLED
+	bool "Default to 'barrier=flush' in reiserfs"
+	depends on REISERFS_FS
+        help
+	  Modern disk drives support write caches that can speed up writeback.
+	  Some devices, in order to improve their performance statistics,
+	  report that the write has been completed even when it has only
+	  been committed to volatile cache memory. This can result in
+	  severe corruption in the event of power loss.
+
+	  The -o barrier option enables the file system to direct the block
+	  layer to issue a barrier, which ensures that the cache has been
+	  flushed before proceeding. This can produce some slowdown in
+	  certain environments, but allows higher end storage arrays with
+	  battery-backed caches to report completes writes sooner than
+	  would be otherwise possible.
+
+	  Without this option, disk write caches should be disabled if
+	  you value data integrity over writeback performance.
+
+	  If unsure, say N.
+
 config REISERFS_FS_XATTR
 	bool "ReiserFS extended attributes"
 	depends on REISERFS_FS
Index: linux-3.0-tmp-jikos/fs/reiserfs/super.c
===================================================================
--- linux-3.0-tmp-jikos.orig/fs/reiserfs/super.c
+++ linux-3.0-tmp-jikos/fs/reiserfs/super.c
@@ -1643,6 +1643,9 @@ 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);
+#ifdef CONFIG_REISERFS_DEFAULTS_TO_BARRIERS_ENABLED
+	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_BARRIER_FLUSH);
+#endif
 	/* no preallocation minimum, be smart in
 	   reiserfs_file_write instead */
 	REISERFS_SB(s)->s_alloc_options.preallocmin = 0;
