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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chris Mason <mason@xxxxxxxx>
Subject: make ext3 mount default to barrier=1

This patch turns on barriers by default for ext3.  mount -o barrier=0
will turn them off.  It also changes the ext3 fsync call to trigger a
barrier when a commit isn't done.

Signed-off-by: Chris Mason <mason@xxxxxxxx>

--- a/fs/ext3/fsync.c	Mon Feb  6 14:42:44 2006 -0500
+++ b/fs/ext3/fsync.c	Mon Feb  6 14:43:14 2006 -0500
@@ -27,6 +27,7 @@
 #include <linux/sched.h>
 #include <linux/writeback.h>
 #include <linux/jbd.h>
+#include <linux/blkdev.h>
 #include <linux/ext3_fs.h>
 #include <linux/ext3_jbd.h>
 
@@ -81,7 +82,10 @@ int ext3_sync_file(struct file * file, s
 			.sync_mode = WB_SYNC_ALL,
 			.nr_to_write = 0, /* sys_fsync did this */
 		};
+		journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
 		ret = sync_inode(inode, &wbc);
+		if (journal && (journal->j_flags & JFS_BARRIER))
+			blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
 	}
 out:
 	return ret;
diff -r b1d8075ee99b fs/ext3/super.c
--- a/fs/ext3/super.c	Mon Feb  6 14:42:44 2006 -0500
+++ b/fs/ext3/super.c	Mon Feb  6 14:43:14 2006 -0500
@@ -1423,6 +1423,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,
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux