Mercurial > hg > xemacs-beta
diff src/fileio.c @ 4499:eb82259f265d
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 <kehoea@parhasard.net>
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.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 09 Aug 2008 16:44:46 +0200 |
parents | 732b87cfabf2 |
children | a5210e70ffbe |
line wrap: on
line diff
--- 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