linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 9/12] ufs: add ->sync_fs
Date: Mon, 8 Jun 2009 10:08:05 +0200	[thread overview]
Message-ID: <20090608080805.GJ20735@lst.de> (raw)
In-Reply-To: <20090608080252.GA20735@lst.de>

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.


Signed-off-by: Christoph Hellwig <hch@lst.de>


Index: vfs-2.6/fs/ufs/super.c
===================================================================
--- vfs-2.6.orig/fs/ufs/super.c	2009-06-05 16:27:47.634965023 +0200
+++ vfs-2.6/fs/ufs/super.c	2009-06-05 16:29:38.547814343 +0200
@@ -1124,7 +1124,7 @@ failed_nomem:
 	return -ENOMEM;
 }
 
-static void ufs_write_super(struct super_block *sb)
+static int ufs_sync_fs(struct super_block *sb, int wait)
 {
 	struct ufs_sb_private_info * uspi;
 	struct ufs_super_block_first * usb1;
@@ -1133,25 +1133,36 @@ static void ufs_write_super(struct super
 
 	lock_super(sb);
 	lock_kernel();
+
 	UFSD("ENTER\n");
+
 	flags = UFS_SB(sb)->s_flags;
 	uspi = UFS_SB(sb)->s_uspi;
 	usb1 = ubh_get_usb_first(uspi);
 	usb3 = ubh_get_usb_third(uspi);
 
-	if (!(sb->s_flags & MS_RDONLY)) {
-		usb1->fs_time = cpu_to_fs32(sb, get_seconds());
-		if ((flags & UFS_ST_MASK) == UFS_ST_SUN 
-		  || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
-		  || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
-			ufs_set_fs_state(sb, usb1, usb3,
-					UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
-		ufs_put_cstotal(sb);
-	}
+	usb1->fs_time = cpu_to_fs32(sb, get_seconds());
+	if ((flags & UFS_ST_MASK) == UFS_ST_SUN  ||
+	    (flags & UFS_ST_MASK) == UFS_ST_SUNOS ||
+	    (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
+		ufs_set_fs_state(sb, usb1, usb3,
+				UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
+	ufs_put_cstotal(sb);
 	sb->s_dirt = 0;
+
 	UFSD("EXIT\n");
 	unlock_kernel();
 	unlock_super(sb);
+
+	return 0;
+}
+
+static void ufs_write_super(struct super_block *sb)
+{
+	if (!(sb->s_flags & MS_RDONLY))
+		ufs_sync_fs(sb, 1);
+	else
+		sb->s_dirt = 0;
 }
 
 static void ufs_put_super(struct super_block *sb)
@@ -1372,6 +1383,7 @@ static const struct super_operations ufs
 	.delete_inode	= ufs_delete_inode,
 	.put_super	= ufs_put_super,
 	.write_super	= ufs_write_super,
+	.sync_fs	= ufs_sync_fs,
 	.statfs		= ufs_statfs,
 	.remount_fs	= ufs_remount,
 	.show_options   = ufs_show_options,

  parent reply	other threads:[~2009-06-08  8:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  8:02 [PATCH 0/12] make ->sync_fs mandatory Christoph Hellwig
2009-06-08  8:03 ` [PATCH 1/12] affs: add ->sync_fs Christoph Hellwig
2009-06-08  8:03 ` [PATCH 2/12] bfs: " Christoph Hellwig
2009-06-08  8:03 ` [PATCH 3/12] exofs: " Christoph Hellwig
2009-06-09 13:03   ` Boaz Harrosh
2009-06-08  8:04 ` [PATCH 4/12] ext2: " Christoph Hellwig
2009-06-08  8:04 ` [PATCH 0/12] make ->sync_fs mandatory Christoph Hellwig
2009-06-08  8:04 ` [PATCH 6/12] hfs: add ->sync_fs Christoph Hellwig
2009-06-08  8:05 ` [PATCH 7/12] hfsplus: " Christoph Hellwig
2009-06-08  8:07 ` [PATCH 8/12] sysv: " Christoph Hellwig
2009-06-08  8:08 ` Christoph Hellwig [this message]
2009-06-08  8:08 ` [PATCH 10/12] jffs2: call jffs2_write_super from jffs2_sync_fs Christoph Hellwig
2009-06-08  8:08 ` [PATCH 11/12] nilfs2: call nilfs2_write_super from nilfs2_sync_fs Christoph Hellwig
2009-06-08  8:08 ` [PATCH 12/12] remove the call to ->write_super in __sync_filesystem Christoph Hellwig
2009-06-08 14:45 ` [PATCH 0/12] make ->sync_fs mandatory Al Viro
2009-06-09 12:55   ` Boaz Harrosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090608080805.GJ20735@lst.de \
    --to=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).