aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2023-01-02 10:00:41 -0800
committerPaul Eggert2023-01-02 11:29:06 -0800
commit2ee6012b3faaf12710ec63626795148caeef0f6a (patch)
tree4d305a3d2dc5d05eee0f6ebb0d1078c5e8c9ac25 /src
parentc209802f7b3721a1b95113290934a23fee88f678 (diff)
downloademacs-2ee6012b3faaf12710ec63626795148caeef0f6a.tar.gz
emacs-2ee6012b3faaf12710ec63626795148caeef0f6a.zip
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')
-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)
6334 umask (realmask); 6334 umask (realmask);
6335 6335
6336 valid_timestamp_file_system = 0; 6336 valid_timestamp_file_system = 0;
6337
6338 /* fsync can be a significant performance hit. Often it doesn't
6339 suffice to make the file-save operation survive a crash. For
6340 batch scripts, which are typically part of larger shell commands
6341 that don't fsync other files, its effect on performance can be
6342 significant so its utility is particularly questionable.
6343 Hence, for now by default fsync is used only when interactive.
6344
6345 For more on why fsync often fails to work on today's hardware, see:
6346 Zheng M et al. Understanding the robustness of SSDs under power fault.
6347 11th USENIX Conf. on File and Storage Technologies, 2013 (FAST '13), 271-84
6348 https://www.usenix.org/system/files/conference/fast13/fast13-final80.pdf
6349
6350 For more on why fsync does not suffice even if it works properly, see:
6351 Roche X. Necessary step(s) to synchronize filename operations on disk.
6352 Austin Group Defect 672, 2013-03-19
6353 https://austingroupbugs.net/view.php?id=672 */
6354 write_region_inhibit_fsync = noninteractive;
6355} 6337}
6356 6338
6357void 6339void
@@ -6609,9 +6591,22 @@ file is usually more useful if it contains the deleted text. */);
6609 DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync, 6591 DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync,
6610 doc: /* Non-nil means don't call fsync in `write-region'. 6592 doc: /* Non-nil means don't call fsync in `write-region'.
6611This variable affects calls to `write-region' as well as save commands. 6593This variable affects calls to `write-region' as well as save commands.
6612Setting this to nil may avoid data loss if the system loses power or 6594By default, it is non-nil.
6613the operating system crashes. By default, it is non-nil in batch mode. */); 6595
6614 write_region_inhibit_fsync = 0; /* See also `init_fileio' above. */ 6596Although setting this to nil may avoid data loss if the system loses power,
6597it can be a significant performance hit in the usual case, and it doesn't
6598necessarily cause file-save operations to actually survive a crash. */);
6599
6600 /* For more on why fsync often fails to work on today's hardware, see:
6601 Zheng M et al. Understanding the robustness of SSDs under power fault.
6602 11th USENIX Conf. on File and Storage Technologies, 2013 (FAST '13), 271-84
6603 https://www.usenix.org/system/files/conference/fast13/fast13-final80.pdf
6604
6605 For more on why fsync does not suffice even if it works properly, see:
6606 Roche X. Necessary step(s) to synchronize filename operations on disk.
6607 Austin Group Defect 672, 2013-03-19
6608 https://austingroupbugs.net/view.php?id=672 */
6609 write_region_inhibit_fsync = true;
6615 6610
6616 DEFVAR_BOOL ("delete-by-moving-to-trash", delete_by_moving_to_trash, 6611 DEFVAR_BOOL ("delete-by-moving-to-trash", delete_by_moving_to_trash,
6617 doc: /* Specifies whether to use the system's trash can. 6612 doc: /* Specifies whether to use the system's trash can.