summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-01-02 10:00:41 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2023-01-02 11:29:06 -0800
commit2ee6012b3faaf12710ec63626795148caeef0f6a (patch)
tree4d305a3d2dc5d05eee0f6ebb0d1078c5e8c9ac25 /src/fileio.c
parentc209802f7b3721a1b95113290934a23fee88f678 (diff)
downloademacs-2ee6012b3faaf12710ec63626795148caeef0f6a.tar.gz
Improve interactive file-saving performance
* src/fileio.c (init_fileio): No longer any need to set write-region-inhibit-fsync here. (syms_of_fileio): Default write-region-inhibit-fsync to t (Bug#60474).
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 7fb7f5ddc5e..c672e0f7baf 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6334,24 +6334,6 @@ init_fileio (void)
umask (realmask);
valid_timestamp_file_system = 0;
-
- /* fsync can be a significant performance hit. Often it doesn't
- suffice to make the file-save operation survive a crash. For
- batch scripts, which are typically part of larger shell commands
- that don't fsync other files, its effect on performance can be
- significant so its utility is particularly questionable.
- Hence, for now by default fsync is used only when interactive.
-
- For more on why fsync often fails to work on today's hardware, see:
- Zheng M et al. Understanding the robustness of SSDs under power fault.
- 11th USENIX Conf. on File and Storage Technologies, 2013 (FAST '13), 271-84
- https://www.usenix.org/system/files/conference/fast13/fast13-final80.pdf
-
- For more on why fsync does not suffice even if it works properly, see:
- Roche X. Necessary step(s) to synchronize filename operations on disk.
- Austin Group Defect 672, 2013-03-19
- https://austingroupbugs.net/view.php?id=672 */
- write_region_inhibit_fsync = noninteractive;
}
void
@@ -6609,9 +6591,22 @@ file is usually more useful if it contains the deleted text. */);
DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync,
doc: /* Non-nil means don't call fsync in `write-region'.
This variable affects calls to `write-region' as well as save commands.
-Setting this to nil may avoid data loss if the system loses power or
-the operating system crashes. By default, it is non-nil in batch mode. */);
- write_region_inhibit_fsync = 0; /* See also `init_fileio' above. */
+By default, it is non-nil.
+
+Although setting this to nil may avoid data loss if the system loses power,
+it can be a significant performance hit in the usual case, and it doesn't
+necessarily cause file-save operations to actually survive a crash. */);
+
+ /* For more on why fsync often fails to work on today's hardware, see:
+ Zheng M et al. Understanding the robustness of SSDs under power fault.
+ 11th USENIX Conf. on File and Storage Technologies, 2013 (FAST '13), 271-84
+ https://www.usenix.org/system/files/conference/fast13/fast13-final80.pdf
+
+ For more on why fsync does not suffice even if it works properly, see:
+ Roche X. Necessary step(s) to synchronize filename operations on disk.
+ Austin Group Defect 672, 2013-03-19
+ https://austingroupbugs.net/view.php?id=672 */
+ write_region_inhibit_fsync = true;
DEFVAR_BOOL ("delete-by-moving-to-trash", delete_by_moving_to_trash,
doc: /* Specifies whether to use the system's trash can.