From patchwork Tue Apr 14 20:25:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 461265 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 B1D0B140134 for ; Wed, 15 Apr 2015 06:26:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754073AbbDNUZd (ORCPT ); Tue, 14 Apr 2015 16:25:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52609 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570AbbDNUZc (ORCPT ); Tue, 14 Apr 2015 16:25:32 -0400 Received: from akpm3.mtv.corp.google.com (unknown [216.239.45.95]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 54C5BB30; Tue, 14 Apr 2015 20:25:31 +0000 (UTC) Date: Tue, 14 Apr 2015 13:25:31 -0700 From: akpm@linux-foundation.org To: tytso@mit.edu, linux-ext4@vger.kernel.org, akpm@linux-foundation.org, fabf@skynet.be, hch@infradead.org, jack@suse.cz, lczerner@redhat.com, viro@zeniv.linux.org.uk Subject: [patch 1/2] fs/ext4/fsync.c: generic_file_fsync call based on barrier flag Message-ID: <552d77bb.NxPkttc8NtgPTL7d%akpm@linux-foundation.org> User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Fabian Frederick Subject: fs/ext4/fsync.c: generic_file_fsync call based on barrier flag generic_file_fsync has been updated to issue a flush for older filesystems. This patch tests for barrier flag in ext4 mount flags and calls the right function. Lukas said: : Note that the actual generic_file_fsync change fixes a real bug in ext4 : where we would _not_ send a flush on sync if we have file system : without journal. : : Ted, it would be useful to mention that in the commit description : along with the commit id: : : ac13a829f6adb674015ab399594c089990104af7 fs/libfs.c: add generic : data flush to fsync Signed-off-by: Fabian Frederick Suggested-by: Jan Kara Suggested-by: Christoph Hellwig Reviewed-by: Lukas Czerner Cc: Jan Kara Cc: Christoph Hellwig Cc: Alexander Viro Cc: "Theodore Ts'o" Signed-off-by: Andrew Morton --- fs/ext4/fsync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff -puN fs/ext4/fsync.c~fs-ext4-fsyncc-generic_file_fsync-call-based-on-barrier-flag fs/ext4/fsync.c --- a/fs/ext4/fsync.c~fs-ext4-fsyncc-generic_file_fsync-call-based-on-barrier-flag +++ a/fs/ext4/fsync.c @@ -107,7 +107,10 @@ int ext4_sync_file(struct file *file, lo } if (!journal) { - ret = generic_file_fsync(file, start, end, datasync); + if (test_opt(inode->i_sb, BARRIER)) + ret = generic_file_fsync(file, start, end, datasync); + else + ret = __generic_file_fsync(file, start, end, datasync); if (!ret && !hlist_empty(&inode->i_dentry)) ret = ext4_sync_parent(inode); goto out;