From patchwork Fri Mar 26 16:21:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Surbhi Palande X-Patchwork-Id: 48657 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 09829B7C7E for ; Sat, 27 Mar 2010 03:21:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751695Ab0CZQVO (ORCPT ); Fri, 26 Mar 2010 12:21:14 -0400 Received: from adelie.canonical.com ([91.189.90.139]:47471 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473Ab0CZQVN (ORCPT ); Fri, 26 Mar 2010 12:21:13 -0400 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NvCHU-0005LR-Oa; Fri, 26 Mar 2010 16:21:09 +0000 Received: from a88-112-254-38.elisa-laajakaista.fi ([88.112.254.38] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1NvCHU-0002lY-JT; Fri, 26 Mar 2010 16:21:08 +0000 From: Surbhi Palande To: linux-ext4@vger.kernel.org Cc: Theodore Tso Subject: [PATCH] ext4: Ensure writecache to disk in no journal mode Date: Fri, 26 Mar 2010 18:21:02 +0200 Message-Id: <1269620462-25906-1-git-send-email-surbhi.palande@canonical.com> X-Mailer: git-send-email 1.6.3.3 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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: