1 From: Chris Mason <mason@suse.com>
2 Subject: make ext3 mount default to barrier=1
6 This patch turns on barriers by default for ext3. mount -o barrier=0
7 will turn them off. It also changes the ext3 fsync call to trigger a
8 barrier when a commit isn't done.
10 It should be safe, but some extra review would be appreciated.
12 Acked-by: Jeff Mahoney <jeffm@suse.com>
15 fs/ext3/fsync.c | 4 ++++
16 fs/ext3/super.c | 2 ++
17 2 files changed, 6 insertions(+)
22 #include <linux/sched.h>
23 #include <linux/writeback.h>
24 #include <linux/jbd.h>
25 +#include <linux/blkdev.h>
26 #include <linux/ext3_fs.h>
27 #include <linux/ext3_jbd.h>
29 @@ -84,7 +85,10 @@ int ext3_sync_file(struct file * file, s
30 .sync_mode = WB_SYNC_ALL,
31 .nr_to_write = 0, /* sys_fsync did this */
33 + journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
34 ret = sync_inode(inode, &wbc);
35 + if (journal && (journal->j_flags & JFS_BARRIER))
36 + blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
42 @@ -1603,6 +1603,8 @@ static int ext3_fill_super (struct super
43 sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
44 sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
46 + /* enable barriers by default */
47 + set_opt(sbi->s_mount_opt, BARRIER);
48 set_opt(sbi->s_mount_opt, RESERVATION);
50 if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,