From patchwork Fri Mar 26 16:21:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: ext4: Ensure writecache to disk in no journal mode Date: Fri, 26 Mar 2010 06:21:02 -0000 From: Surbhi Palande X-Patchwork-Id: 48657 Message-Id: <1269620462-25906-1-git-send-email-surbhi.palande@canonical.com> To: linux-ext4@vger.kernel.org Cc: Theodore Tso Ensure that in the no journal mode the write cache is flushed to the disk by calling a blkdev_issue_flush() which issues a WRITE_BARRIER if necessary. Signed-off-by: Surbhi Palande --- fs/ext4/fsync.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index d6049e4..1d73a50 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -67,8 +67,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync) if (ret < 0) return ret; - if (!journal) - return simple_fsync(file, dentry, datasync); + if (!journal) { + ret = simple_fsync(file, dentry, datasync); + if (test_opt(inode->i_sb, BARRIER)) + blkdev_issue_flush(inode->i_sb->s_bdev, NULL); + return ret; + } /* * data=writeback,ordered: