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

Re: writing processes are blocking in log_wait_common with data=ordered

David Mansfield wrote:
> I hate when this happens, but I have to reply to myself.  Of course, the
> subject line should read: log_wait_commit.  And I should mention that the
> file is opened with O_SYNC.

O_SYNC is rather a blunt instrument - you may get better results
by using an explicit fsync() at the points where you really care.
Of course, if you end up putting an fsync() after each and every
pwrite() then that's equivalent to O_SYNC and I can be safely

I can only thing of one reason why we're opening a transaction
in the file overwrite case: mtime updates.

And the kernel does lots of needless mtime updates.  We only
need to write out the new mtime if it actually changed. Does
this patch help?

--- linux-2.4.19-pre7/mm/filemap.c	Tue Apr 16 01:17:56 2002
+++ linux-akpm/mm/filemap.c	Tue Apr 30 12:32:56 2002
@@ -3026,8 +3026,15 @@ generic_file_write(struct file *file,con
 		goto out;
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME;
-	mark_inode_dirty_sync(inode);
+	{
+		unsigned long now = CURRENT_TIME;
+		if (inode->i_ctime != now || inode->i_mtime != now) {
+			inode->i_ctime = now;
+			inode->i_mtime = now;
+			mark_inode_dirty_sync(inode);
+		}
+	}
 	if (file->f_flags & O_DIRECT)
 		goto o_direct;


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