# HG changeset patch # User Aidan Kehoe # Date 1218293086 -7200 # Node ID eb82259f265d18b2bc5c9e76d0f1222f5a0976e8 # Parent 89406c31b12521258c83389d19f80440a3a7ce48 Port write-region-inhibit-sync, allowing avoidance of bad FS performance. See http://shaver.off.net/diary/2008/05/25/fsyncers-and-curveballs/ for more details. 2008-08-09 Aidan Kehoe Integrate Romain Francoise' 2005-09-14 (pre-GPLV3) GNU change, which can allow much better performace with some stupid filesystems: * fileio.c (write_region_inhibit_fsync): New variable. (Fwrite_region): Use it to skip call to fsync. (syms_of_fileio): Initialize it. diff -r 89406c31b125 -r eb82259f265d src/ChangeLog --- a/src/ChangeLog Sat Aug 09 12:13:19 2008 +0200 +++ b/src/ChangeLog Sat Aug 09 16:44:46 2008 +0200 @@ -1,3 +1,12 @@ +2008-08-09 Aidan Kehoe + + Integrate Romain Francoise' 2005-09-14 (pre-GPLV3) GNU change, + which can allow much better performace with some stupid + filesystems: + * fileio.c (write_region_inhibit_fsync): New variable. + (Fwrite_region): Use it to skip call to fsync. + (syms_of_fileio): Initialize it. + 2008-08-05 Aidan Kehoe * mule-charset.c (complex_vars_of_mule_charset): diff -r 89406c31b125 -r eb82259f265d src/fileio.c --- a/src/fileio.c Sat Aug 09 12:13:19 2008 +0200 +++ b/src/fileio.c Sat Aug 09 16:44:46 2008 +0200 @@ -111,6 +111,11 @@ Lisp_Object Vdirectory_sep_char; +#ifdef HAVE_FSYNC +/* Nonzero means skip the call to fsync in Fwrite-region. */ +int write_region_inhibit_fsync; +#endif + /* These variables describe handlers that have "already" had a chance to handle the current operation. @@ -3568,7 +3573,7 @@ Disk full in NFS may be reported here. */ /* mib says that closing the file will try to write as fast as NFS can do it, and that means the fsync here is not crucial for autosave files. */ - if (!auto_saving && fsync (desc) < 0 + if (!auto_saving && !write_region_inhibit_fsync && fsync (desc) < 0 /* If fsync fails with EINTR, don't treat that as serious. */ && errno != EINTR) { @@ -4560,6 +4565,15 @@ */ ); Vauto_save_list_file_name = Qnil; +#ifdef HAVE_FSYNC + DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync /* +*Non-nil means don't call fsync in `write-region'. +This variable affects calls to `write-region' as well as save commands. +A non-nil value may result in data loss! +*/ ); + write_region_inhibit_fsync = 0; +#endif + DEFVAR_LISP ("auto-save-list-file-prefix", &Vauto_save_list_file_prefix /* Prefix for generating auto-save-list-file-name. Emacs's pid and the system name will be appended to