Add journal checksum patches. Also move
[ext4-patch-queue.git] / ext4-call-blkdev_issue_flush-on-fsync.patch
blobe8db8ca14a7069dad3faae0f4cbc3e3ae1e005d8
1 ext4: call blkdev_issue_flush on fsync
3 From: Eric Sandeen <sandeen@redhat.com>
5 To ensure that bits are truly on-disk after an fsync,
6 we should call blkdev_issue_flush if barriers are supported.
8 Inspired by an old thread on barriers, by reiserfs & xfs
9 which do the same, and by a patch SuSE ships with their kernel
11 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
12 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
13 ---
14 fs/ext4/fsync.c | 4 ++++
15 1 file changed, 4 insertions(+)
17 Index: linux-2.6.26-rc4/fs/ext4/fsync.c
18 ===================================================================
19 --- linux-2.6.26-rc4.orig/fs/ext4/fsync.c 2008-05-29 10:52:28.000000000 -0700
20 +++ linux-2.6.26-rc4/fs/ext4/fsync.c 2008-05-29 10:52:37.000000000 -0700
21 @@ -27,6 +27,7 @@
22 #include <linux/sched.h>
23 #include <linux/writeback.h>
24 #include <linux/jbd2.h>
25 +#include <linux/blkdev.h>
26 #include "ext4.h"
27 #include "ext4_jbd2.h"
29 @@ -45,6 +46,7 @@
30 int ext4_sync_file(struct file * file, struct dentry *dentry, int datasync)
32 struct inode *inode = dentry->d_inode;
33 + journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
34 int ret = 0;
36 J_ASSERT(ext4_journal_current_handle() == NULL);
37 @@ -85,6 +87,8 @@ int ext4_sync_file(struct file * file, s
38 .nr_to_write = 0, /* sys_fsync did this */
40 ret = sync_inode(inode, &wbc);
41 + if (journal && (journal->j_flags & JBD2_BARRIER))
42 + blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
44 out:
45 return ret;