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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Hisashi Hifumi <hifumi.hisashi@...>
Cc: <akpm@...>, <linux-ext4@...>, <linux-fsdevel@...>
Date: Thursday, November 15, 2007 - 11:43 pm

On Fri, 16 November 2007 11:47:27 +0900, Hisashi Hifumi wrote:

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@logfs.org>
---

 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
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, 10:47 pm)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Jörn, (Thu Nov 15, 11:43 pm)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Andrew Morton, (Thu Nov 15, 10:59 pm)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Hisashi Hifumi, (Tue Nov 20, 3:20 am)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Andrew Morton, (Thu Nov 15, 11:53 pm)
Re: [PATCH] ext3,4:fdatasync should skip metadata writeout, Bryan Henderson, (Fri Nov 16, 2:12 pm)