diff options
| author | Romain Francoise | 2013-11-23 12:32:05 +0100 |
|---|---|---|
| committer | Romain Francoise | 2013-11-23 12:32:05 +0100 |
| commit | 1db72ad330fcf4e50bfd1917e52685e3978d92e5 (patch) | |
| tree | 064c2f06e65a42419f13134afb84052a64d9251d /src | |
| parent | 40dd812fa3258999a73db709df603dde74d7d577 (diff) | |
| download | emacs-1db72ad330fcf4e50bfd1917e52685e3978d92e5.tar.gz emacs-1db72ad330fcf4e50bfd1917e52685e3978d92e5.zip | |
Really initialize `write_region_inhibit_fsync' when interactive.
* fileio.c (init_fileio): Move `write_region_inhibit_fsync'
initialization here ...
(syms_of_fileio): ... from here.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/fileio.c | 36 |
2 files changed, 25 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e9454a783e9..d17f320516c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-11-23 Romain Francoise <romain@orebokech.com> | ||
| 2 | |||
| 3 | * fileio.c (init_fileio): Move `write_region_inhibit_fsync' | ||
| 4 | initialization here ... | ||
| 5 | (syms_of_fileio): ... from here. | ||
| 6 | |||
| 1 | 2013-11-23 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2013-11-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * lread.c (init_lread): Fix int/Lisp_Object mixup. | 9 | * lread.c (init_lread): Fix int/Lisp_Object mixup. |
diff --git a/src/fileio.c b/src/fileio.c index 2c90d2e3c76..07d36016186 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5773,6 +5773,24 @@ void | |||
| 5773 | init_fileio (void) | 5773 | init_fileio (void) |
| 5774 | { | 5774 | { |
| 5775 | valid_timestamp_file_system = 0; | 5775 | valid_timestamp_file_system = 0; |
| 5776 | |||
| 5777 | /* fsync can be a significant performance hit. Often it doesn't | ||
| 5778 | suffice to make the file-save operation survive a crash. For | ||
| 5779 | batch scripts, which are typically part of larger shell commands | ||
| 5780 | that don't fsync other files, its effect on performance can be | ||
| 5781 | significant so its utility is particularly questionable. | ||
| 5782 | Hence, for now by default fsync is used only when interactive. | ||
| 5783 | |||
| 5784 | For more on why fsync often fails to work on today's hardware, see: | ||
| 5785 | Zheng M et al. Understanding the robustness of SSDs under power fault. | ||
| 5786 | 11th USENIX Conf. on File and Storage Technologies, 2013 (FAST '13), 271-84 | ||
| 5787 | http://www.usenix.org/system/files/conference/fast13/fast13-final80.pdf | ||
| 5788 | |||
| 5789 | For more on why fsync does not suffice even if it works properly, see: | ||
| 5790 | Roche X. Necessary step(s) to synchronize filename operations on disk. | ||
| 5791 | Austin Group Defect 672, 2013-03-19 | ||
| 5792 | http://austingroupbugs.net/view.php?id=672 */ | ||
| 5793 | write_region_inhibit_fsync = noninteractive; | ||
| 5776 | } | 5794 | } |
| 5777 | 5795 | ||
| 5778 | void | 5796 | void |
| @@ -5985,28 +6003,12 @@ in the buffer; this is the default behavior, because the auto-save | |||
| 5985 | file is usually more useful if it contains the deleted text. */); | 6003 | file is usually more useful if it contains the deleted text. */); |
| 5986 | Vauto_save_include_big_deletions = Qnil; | 6004 | Vauto_save_include_big_deletions = Qnil; |
| 5987 | 6005 | ||
| 5988 | /* fsync can be a significant performance hit. Often it doesn't | ||
| 5989 | suffice to make the file-save operation survive a crash. For | ||
| 5990 | batch scripts, which are typically part of larger shell commands | ||
| 5991 | that don't fsync other files, its effect on performance can be | ||
| 5992 | significant so its utility is particularly questionable. | ||
| 5993 | Hence, for now by default fsync is used only when interactive. | ||
| 5994 | |||
| 5995 | For more on why fsync often fails to work on today's hardware, see: | ||
| 5996 | Zheng M et al. Understanding the robustness of SSDs under power fault. | ||
| 5997 | 11th USENIX Conf. on File and Storage Technologies, 2013 (FAST '13), 271-84 | ||
| 5998 | http://www.usenix.org/system/files/conference/fast13/fast13-final80.pdf | ||
| 5999 | |||
| 6000 | For more on why fsync does not suffice even if it works properly, see: | ||
| 6001 | Roche X. Necessary step(s) to synchronize filename operations on disk. | ||
| 6002 | Austin Group Defect 672, 2013-03-19 | ||
| 6003 | http://austingroupbugs.net/view.php?id=672 */ | ||
| 6004 | DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync, | 6006 | DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync, |
| 6005 | doc: /* Non-nil means don't call fsync in `write-region'. | 6007 | doc: /* Non-nil means don't call fsync in `write-region'. |
| 6006 | This variable affects calls to `write-region' as well as save commands. | 6008 | This variable affects calls to `write-region' as well as save commands. |
| 6007 | Setting this to nil may avoid data loss if the system loses power or | 6009 | Setting this to nil may avoid data loss if the system loses power or |
| 6008 | the operating system crashes. */); | 6010 | the operating system crashes. */); |
| 6009 | write_region_inhibit_fsync = noninteractive; | 6011 | write_region_inhibit_fsync = 0; /* See also `init_fileio' above. */ |
| 6010 | 6012 | ||
| 6011 | DEFVAR_BOOL ("delete-by-moving-to-trash", delete_by_moving_to_trash, | 6013 | DEFVAR_BOOL ("delete-by-moving-to-trash", delete_by_moving_to_trash, |
| 6012 | doc: /* Specifies whether to use the system's trash can. | 6014 | doc: /* Specifies whether to use the system's trash can. |