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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 16 November 2007 11:47:27 +0900, Hisashi Hifumi wrote:
> 
> 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.

This is wrong.  If I_DIRTY_DATASYNC is set, the inode needs to be
written even for datasync.

How about the patch below?

Jörn

-- 
Audacity augments courage; hesitation, fear.
-- Publilius Syrus


Signed-off-by: Jörn Engel <joern@xxxxxxxxx>
---

 fs/ext3/fsync.c |    3 ++-
 fs/ext4/fsync.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

--- git_I_DIRTY/fs/ext3/fsync.c~ext3_datasync	2007-11-15 20:51:54.000000000 +0100
+++ git_I_DIRTY/fs/ext3/fsync.c	2007-11-16 04:42:28.000000000 +0100
@@ -76,7 +76,8 @@ int ext3_sync_file(struct file * file, s
 	 * The VFS has written the file data.  If the inode is unaltered
 	 * then we need not start a commit.
 	 */
-	if (inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC)) {
+	if (((inode->i_state & I_DIRTY_SYNC) && !datasync)
+			|| (inode->i_state & I_DIRTY_DATASYNC)) {
 		struct writeback_control wbc = {
 			.sync_mode = WB_SYNC_ALL,
 			.nr_to_write = 0, /* sys_fsync did this */
--- git_I_DIRTY/fs/ext4/fsync.c~ext3_datasync	2007-11-15 20:51:54.000000000 +0100
+++ git_I_DIRTY/fs/ext4/fsync.c	2007-11-16 04:44:29.000000000 +0100
@@ -76,7 +76,8 @@ int ext4_sync_file(struct file * file, s
 	 * The VFS has written the file data.  If the inode is unaltered
 	 * then we need not start a commit.
 	 */
-	if (inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC)) {
+	if (((inode->i_state & I_DIRTY_SYNC) && !datasync)
+			|| (inode->i_state & I_DIRTY_DATASYNC)) {
 		struct writeback_control wbc = {
 			.sync_mode = WB_SYNC_ALL,
 			.nr_to_write = 0, /* sys_fsync did this */
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux