Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
4493:89406c31b125 | 4499:eb82259f265d |
---|---|
108 int inhibit_auto_save_session; | 108 int inhibit_auto_save_session; |
109 | 109 |
110 int disable_auto_save_when_buffer_shrinks; | 110 int disable_auto_save_when_buffer_shrinks; |
111 | 111 |
112 Lisp_Object Vdirectory_sep_char; | 112 Lisp_Object Vdirectory_sep_char; |
113 | |
114 #ifdef HAVE_FSYNC | |
115 /* Nonzero means skip the call to fsync in Fwrite-region. */ | |
116 int write_region_inhibit_fsync; | |
117 #endif | |
113 | 118 |
114 /* These variables describe handlers that have "already" had a chance | 119 /* These variables describe handlers that have "already" had a chance |
115 to handle the current operation. | 120 to handle the current operation. |
116 | 121 |
117 Vinhibit_file_name_handlers is a list of file name handlers. | 122 Vinhibit_file_name_handlers is a list of file name handlers. |
3566 #ifdef HAVE_FSYNC | 3571 #ifdef HAVE_FSYNC |
3567 /* Note fsync appears to change the modtime on BSD4.2 (both vax and sun). | 3572 /* Note fsync appears to change the modtime on BSD4.2 (both vax and sun). |
3568 Disk full in NFS may be reported here. */ | 3573 Disk full in NFS may be reported here. */ |
3569 /* mib says that closing the file will try to write as fast as NFS can do | 3574 /* mib says that closing the file will try to write as fast as NFS can do |
3570 it, and that means the fsync here is not crucial for autosave files. */ | 3575 it, and that means the fsync here is not crucial for autosave files. */ |
3571 if (!auto_saving && fsync (desc) < 0 | 3576 if (!auto_saving && !write_region_inhibit_fsync && fsync (desc) < 0 |
3572 /* If fsync fails with EINTR, don't treat that as serious. */ | 3577 /* If fsync fails with EINTR, don't treat that as serious. */ |
3573 && errno != EINTR) | 3578 && errno != EINTR) |
3574 { | 3579 { |
3575 failure = 1; | 3580 failure = 1; |
3576 save_errno = errno; | 3581 save_errno = errno; |
4558 DEFVAR_LISP ("auto-save-list-file-name", &Vauto_save_list_file_name /* | 4563 DEFVAR_LISP ("auto-save-list-file-name", &Vauto_save_list_file_name /* |
4559 File name in which we write a list of all auto save file names. | 4564 File name in which we write a list of all auto save file names. |
4560 */ ); | 4565 */ ); |
4561 Vauto_save_list_file_name = Qnil; | 4566 Vauto_save_list_file_name = Qnil; |
4562 | 4567 |
4568 #ifdef HAVE_FSYNC | |
4569 DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync /* | |
4570 *Non-nil means don't call fsync in `write-region'. | |
4571 This variable affects calls to `write-region' as well as save commands. | |
4572 A non-nil value may result in data loss! | |
4573 */ ); | |
4574 write_region_inhibit_fsync = 0; | |
4575 #endif | |
4576 | |
4563 DEFVAR_LISP ("auto-save-list-file-prefix", &Vauto_save_list_file_prefix /* | 4577 DEFVAR_LISP ("auto-save-list-file-prefix", &Vauto_save_list_file_prefix /* |
4564 Prefix for generating auto-save-list-file-name. | 4578 Prefix for generating auto-save-list-file-name. |
4565 Emacs's pid and the system name will be appended to | 4579 Emacs's pid and the system name will be appended to |
4566 this prefix to create a unique file name. | 4580 this prefix to create a unique file name. |
4567 */ ); | 4581 */ ); |