Setting tag linux-2.6-27-38
[linux-2.6.git] / linux-2.6-900-ext3_mount_default_to_barrier.patch
1 commit 412e7b7a7e5804e0e04ad31b98db52314cc6168a
2 Author: S.Çağlar Onur <caglar@cs.princeton.edu>
3 Date:   Fri Apr 2 18:35:07 2010 -0400
4
5     ext3_mount_default_to_barrier.patch
6
7 diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c
8 index d336341..737f9ed 100644
9 --- a/fs/ext3/fsync.c
10 +++ b/fs/ext3/fsync.c
11 @@ -27,6 +27,7 @@
12  #include <linux/sched.h>
13  #include <linux/writeback.h>
14  #include <linux/jbd.h>
15 +#include <linux/blkdev.h>
16  #include <linux/ext3_fs.h>
17  #include <linux/ext3_jbd.h>
18  
19 @@ -84,7 +85,10 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
20                         .sync_mode = WB_SYNC_ALL,
21                         .nr_to_write = 0, /* sys_fsync did this */
22                 };
23 +               journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
24                 ret = sync_inode(inode, &wbc);
25 +               if (journal && (journal->j_flags & JFS_BARRIER))
26 +                       blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
27         }
28  out:
29         return ret;
30 diff --git a/fs/ext3/super.c b/fs/ext3/super.c
31 index fc4df0d..af90937 100644
32 --- a/fs/ext3/super.c
33 +++ b/fs/ext3/super.c
34 @@ -1621,6 +1621,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
35         sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
36         sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
37  
38 +       /* enable barriers by default */
39 +       set_opt(sbi->s_mount_opt, BARRIER);
40         set_opt(sbi->s_mount_opt, RESERVATION);
41  
42         if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,