diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-04-21 01:27:55 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-04-21 12:51:27 +0200 |
commit | 9139bf81cf81a93e331f98dcddbe489fc3529787 (patch) | |
tree | dc88d53c22ab6504b32c75d74ebbe5e5b6039e82 | |
parent | 498731615c2f879c0b67323aba385c17a4a39d24 (diff) | |
download | rneovim-9139bf81cf81a93e331f98dcddbe489fc3529787.tar.gz rneovim-9139bf81cf81a93e331f98dcddbe489fc3529787.tar.bz2 rneovim-9139bf81cf81a93e331f98dcddbe489fc3529787.zip |
defaults: disable 'fsync'
ref #6725
fsync() is very slow on some systems. And since the parent commit, Nvim
is smarter about flushing files at certain times (e.g. CursorHold),
regardless of whether 'fsync' is enabled. So it's less risky to disable
'fsync'.
Profiling showed slow (2-4s) :write and :quit caused by fsync():
:quit
shada_write_file(NULL, false);
:write + fsync
0 0x00007f72da567b2d in fsync () at ../sysdeps/unix/syscall-template.S:84
1 0x0000000000638970 in uv__fs_fsync (req=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:150
2 uv__fs_work (w=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:953
3 0x0000000000639a70 in uv_fs_fsync (loop=<optimized out>, req=<optimized out>, file=41, cb=0x7f72da567b2d <fsync+45>)
at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:1094
4 0x0000000000573694 in os_fsync (fd=41) at ../src/nvim/os/fs.c:631
5 0x00000000004ec9dc in buf_write (buf=<optimized out>, fname=<optimized out>, sfname=<optimized out>, start=1, end=1997, eap=0x7fffc864c570,
append=<optimized out>, forceit=<optimized out>, reset_changed=<optimized out>, filtering=<optimized out>) at ../src/nvim/fileio.c:3387
6 0x00000000004b44ff in do_write (eap=0x7fffc864c570) at ../src/nvim/ex_cmds.c:1745
...
:write + nofsync
0 0x00007f72da567b2d in fsync () at ../sysdeps/unix/syscall-template.S:84
1 0x0000000000638970 in uv__fs_fsync (req=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:150
2 uv__fs_work (w=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:953
3 0x0000000000639a70 in uv_fs_fsync (loop=<optimized out>, req=<optimized out>, file=36, cb=0x7f72da567b2d <fsync+45>)
at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:1094
4 0x0000000000573694 in os_fsync (fd=36) at ../src/nvim/os/fs.c:631
5 0x0000000000528f5a in mf_sync (mfp=0x7f72d8968d00, flags=5) at ../src/nvim/memfile.c:466
6 0x000000000052d569 in ml_preserve (buf=0x7f72d890f000, message=0) at ../src/nvim/memline.c:1659
7 0x00000000004ebadf in buf_write (buf=<optimized out>, fname=<optimized out>, sfname=<optimized out>, start=1, end=1997, eap=0x7fffc864c570,
append=<optimized out>, forceit=<optimized out>, reset_changed=<optimized out>, filtering=<optimized out>) at ../src/nvim/fileio.c:3071
8 0x00000000004b44ff in do_write (eap=0x7fffc864c570) at ../src/nvim/ex_cmds.c:1745
...
-rw-r--r-- | runtime/doc/options.txt | 24 | ||||
-rw-r--r-- | src/nvim/options.lua | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 0b7c61ea18..a63bef5622 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2690,17 +2690,19 @@ A jump table for the options with a short description can be found at |Q_op|. security reasons. *'fsync'* *'fs'* -'fsync' 'fs' boolean (default on) - global - When on, the library function fsync() will be called after writing a - file. This will flush a file to disk, ensuring that it is safely - written even on filesystems which do metadata-only journaling. This - will force the harddrive to spin up on Linux systems running in laptop - mode, so it may be undesirable in some situations. Be warned that - turning this off increases the chances of data loss after a crash. - - Currently applies only to writing the buffer with e.g. |:w| and - |writefile()|. +'fsync' 'fs' boolean (default off) + global + When on, the OS function fsync() will be called after saving a file + (|:write|, |writefile()|, …), |swap-file| and |shada-file|. This + flushes the file to disk, ensuring that it is safely written. + Slow on some systems: writing buffers, quitting Nvim, and other + operations may sometimes take a few seconds. + + Files are ALWAYS flushed ('fsync' is ignored) when: + - |CursorHold| event is triggered + - |:preserve| is called + - system signals low battery life + - Nvim exits abnormally *'gdefault'* *'gd'* *'nogdefault'* *'nogd'* 'gdefault' 'gd' boolean (default off) diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 80484d0ad2..66018b2475 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -976,7 +976,7 @@ return { secure=true, vi_def=true, varname='p_fs', - defaults={if_true={vi=true}} + defaults={if_true={vi=false}} }, { full_name='gdefault', abbreviation='gd', |