From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 7/12] hfsplus: add ->sync_fs Date: Mon, 8 Jun 2009 10:05:12 +0200 Message-ID: <20090608080512.GH20735@lst.de> References: <20090608080252.GA20735@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: viro@zeniv.linux.org.uk Return-path: Received: from verein.lst.de ([213.95.11.210]:33402 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754527AbZFHIFL (ORCPT ); Mon, 8 Jun 2009 04:05:11 -0400 Content-Disposition: inline In-Reply-To: <20090608080252.GA20735@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Add a ->sync_fs method for data integrity syncs, and reimplement ->write_super ontop of it. Signed-off-by: Christoph Hellwig Index: vfs-2.6/fs/hfsplus/super.c =================================================================== --- vfs-2.6.orig/fs/hfsplus/super.c 2009-06-05 16:17:32.048939821 +0200 +++ vfs-2.6/fs/hfsplus/super.c 2009-06-05 16:19:06.525940458 +0200 @@ -152,7 +152,7 @@ static void hfsplus_clear_inode(struct i } } -static void hfsplus_write_super(struct super_block *sb) +static int hfsplus_sync_fs(struct super_block *sb, int wait) { struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; @@ -160,9 +160,6 @@ static void hfsplus_write_super(struct s lock_super(sb); sb->s_dirt = 0; - if (sb->s_flags & MS_RDONLY) - /* warn? */ - goto out; vhdr->free_blocks = cpu_to_be32(HFSPLUS_SB(sb).free_blocks); vhdr->next_alloc = cpu_to_be32(HFSPLUS_SB(sb).next_alloc); @@ -194,8 +191,16 @@ static void hfsplus_write_super(struct s } HFSPLUS_SB(sb).flags &= ~HFSPLUS_SB_WRITEBACKUP; } - out: unlock_super(sb); + return 0; +} + +static void hfsplus_write_super(struct super_block *sb) +{ + if (!(sb->s_flags & MS_RDONLY)) + hfsplus_sync_fs(sb, 1); + else + sb->s_dirt = 0; } static void hfsplus_put_super(struct super_block *sb) @@ -290,6 +295,7 @@ static const struct super_operations hfs .clear_inode = hfsplus_clear_inode, .put_super = hfsplus_put_super, .write_super = hfsplus_write_super, + .sync_fs = hfsplus_sync_fs, .statfs = hfsplus_statfs, .remount_fs = hfsplus_remount, .show_options = hfsplus_show_options,