[PATCH] ext3,4:fdatasync should skip metadata writeout

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hisashi Hifumi
Date: Thursday, November 15, 2007 - 7:47 pm

Hi.
Currently fdatasync is identical to fsync in ext3,4.
I think fdatasync should skip journal flush in data=ordered and data=writeback mode
because this syscall is not required to synchronize the metadata.

My patch as below is similar to the approach of GFS2's fsync code(gfs2_fsync).

Thanks.

Signed-off-by :Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>

diff -Nrup linux-2.6.24-rc2.org/fs/ext3/fsync.c linux-2.6.24-rc2/fs/ext3/fsync.c
--- linux-2.6.24-rc2.org/fs/ext3/fsync.c	2007-11-07 06:57:46.000000000 +0900
+++ linux-2.6.24-rc2/fs/ext3/fsync.c	2007-11-15 17:50:24.000000000 +0900
@@ -72,6 +72,9 @@ int ext3_sync_file(struct file * file, s
 		goto out;
 	}
 
+	if (datasync)
+		goto out;	
+
 	/*
 	* The VFS has written the file data.  If the inode is unaltered
 	* then we need not start a commit.
diff -Nrup linux-2.6.24-rc2.org/fs/ext4/fsync.c linux-2.6.24-rc2/fs/ext4/fsync.c
--- linux-2.6.24-rc2.org/fs/ext4/fsync.c	2007-11-07 06:57:46.000000000 +0900
+++ linux-2.6.24-rc2/fs/ext4/fsync.c	2007-11-15 17:50:54.000000000 +0900
@@ -72,6 +72,9 @@ int ext4_sync_file(struct file * file, s
 		goto out;
 	}
 
+	if (datasync)
+		goto out;
+
 	/*
 	* The VFS has written the file data.  If the inode is unaltered
 	* then we need not start a commit.
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] ext3,4:fdatasync should skip metadata writeout, Hisashi Hifumi, (Thu Nov 15, 7:47 pm)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Bryan Henderson, (Fri Nov 16, 11:12 am)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Hisashi Hifumi, (Tue Nov 20, 12:20 am)