patch-2.0.37 linux/fs/ext2/fsync.c

Next file: linux/fs/ioctl.c
Previous file: linux/fs/autofs/root.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.36/linux/fs/ext2/fsync.c linux/fs/ext2/fsync.c
@@ -10,6 +10,8 @@
  *  linux/fs/minix/truncate.c   Copyright (C) 1991, 1992  Linus Torvalds
  * 
  *  ext2fs fsync primitive
+ *
+ *  Fast 'fsync' on large files (Scott Laird <laird@pacificrim.net>)
  */
 
 #include <asm/segment.h>
@@ -172,6 +174,13 @@
 		 * Don't sync fast links!
 		 */
 		goto skip;
+
+	/* fsync on large files is *slow*, so fall back to sync() if
+	 * the file's over 10M */
+	if (inode->i_size>10000000) {
+		file_fsync(inode,file);
+		goto skip;
+	}
 
 	for (wait=0; wait<=1; wait++)
 	{

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov