Skip to content

Commit

Permalink
Remove swapsync.
Browse files Browse the repository at this point in the history
It's complete overkill.
  • Loading branch information
sethjackson committed Jan 14, 2016
1 parent bf7bc4d commit 62d137c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 54 deletions.
15 changes: 2 additions & 13 deletions runtime/doc/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2812,7 +2812,6 @@ A jump table for the options with a short description can be found at |Q_op|.
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.
Also see 'swapsync' for controlling fsync() on swap files.

*'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
'gdefault' 'gd' boolean (default off)
Expand Down Expand Up @@ -6204,24 +6203,15 @@ A jump table for the options with a short description can be found at |Q_op|.
When 'swapfile' is reset, the swap file for the current buffer is
immediately deleted. When 'swapfile' is set, and 'updatecount' is
non-zero, a swap file is immediately created.
Also see |swap-file| and |'swapsync'|.
Also see |swap-file|.
If you want to open a new buffer without creating a swap file for it,
use the |:noswapfile| modifier.

This option is used together with 'bufhidden' and 'buftype' to
specify special kinds of buffers. See |special-buffers|.

*'swapsync'* *'sws'*
'swapsync' 'sws' string (default "fsync")
global
When this option is not empty a swap file is synced to disk after
writing to it. This takes some time, especially on busy Unix systems.
When this option is empty parts of the swap file may be in memory and
not written to disk. When the system crashes you may lose more work.
On Unix the system does a sync now and then without Vim asking for it,
so the disadvantage of setting this option off is small. On some
systems the swap file will not be written at all.
The 'fsync' option is used for the actual file.
'swapsync' 'sws' Removed. |vim-differences| {Nvim}

*'switchbuf'* *'swb'*
'switchbuf' 'swb' string (default "")
Expand Down Expand Up @@ -6708,7 +6698,6 @@ A jump table for the options with a short description can be found at |Q_op|.
When 'updatecount' is set from zero to non-zero, swap files are
created for all buffers that have 'swapfile' set. When 'updatecount'
is set to zero, existing swap files are not deleted.
Also see |'swapsync'|.
This option has no meaning in buffers where |'buftype'| is "nofile"
or "nowrite".

Expand Down
1 change: 0 additions & 1 deletion runtime/doc/quickref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,6 @@ Short explanation of each option: *option-list*
'suffixes' 'su' suffixes that are ignored with multiple match
'suffixesadd' 'sua' suffixes added when searching for a file
'swapfile' 'swf' whether to use a swapfile for a buffer
'swapsync' 'sws' how to sync the swap file
'switchbuf' 'swb' sets behavior when switching to another buffer
'synmaxcol' 'smc' maximum column to find syntax items
'syntax' 'syn' syntax to be loaded for current buffer
Expand Down
5 changes: 1 addition & 4 deletions runtime/doc/recover.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ changed, not when you only moved around. The reason why it is not kept up to
date all the time is that this would slow down normal work too much. You can
change the 200 character count with the 'updatecount' option. You can set
the time with the 'updatetime' option. The time is given in milliseconds.
After writing to the swap file Vim syncs the file to disk. This takes some
time, especially on busy Unix systems. If you don't want this you can set the
'swapsync' option to an empty string. The risk of losing work becomes bigger
though.
After writing to the swap file Vim syncs the file to disk.

If the writing to the swap file is not wanted, it can be switched off by
setting the 'updatecount' option to 0. The same is done when starting Vim
Expand Down
1 change: 0 additions & 1 deletion runtime/doc/usr_11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ If you really don't want to see this message, you can add the 'A' flag to the
'updatecount' Number of key strokes after which the swap file is flushed to
disk.
'updatetime' Timeout after which the swap file is flushed to disk.
'swapsync' Whether the disk is synced when the swap file is flushed.
'directory' List of directory names where to store the swap file.
'maxmem' Limit for memory usage before writing text to the swap file.
'maxmemtot' Same, but for all files in total.
Expand Down
1 change: 1 addition & 0 deletions runtime/doc/vim_diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ Other options:
'restorescreen'
'shelltype'
'shortname'
'swapsync'
'termencoding' (Vim 7.4.852 also removed this for Windows)
'textauto'
'textmode'
Expand Down
2 changes: 0 additions & 2 deletions runtime/optwin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,6 @@ call <SID>OptionG("dir", &dir)
call append("$", "swapfile\tuse a swap file for this buffer")
call append("$", "\t(local to buffer)")
call <SID>BinOptionL("swf")
call append("$", "swapsync\t\"sync\", \"fsync\" or empty; how to flush a swap file to disk")
call <SID>OptionG("sws", &sws)
call append("$", "updatecount\tnumber of characters typed to cause a swap file update")
call append("$", " \tset uc=" . &uc)
call append("$", "updatetime\ttime in msec after which the swap file will be updated")
Expand Down
8 changes: 3 additions & 5 deletions src/nvim/memfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,9 @@ int mf_sync(memfile_T *mfp, int flags)
if (hp == NULL || status == FAIL)
mfp->mf_dirty = false;

if ((flags & MFS_FLUSH) && *p_sws != NUL) {
if (STRCMP(p_sws, "fsync") == 0) {
if (os_fsync(mfp->mf_fd)) {
status = FAIL;
}
if (flags & MFS_FLUSH) {
if (os_fsync(mfp->mf_fd)) {
status = FAIL;
}
}

Expand Down
41 changes: 20 additions & 21 deletions src/nvim/option_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,27 +535,26 @@ EXTERN int p_stmp; /* 'shelltemp' */
#ifdef BACKSLASH_IN_FILENAME
EXTERN int p_ssl; /* 'shellslash' */
#endif
EXTERN char_u *p_stl; /* 'statusline' */
EXTERN int p_sr; /* 'shiftround' */
EXTERN char_u *p_shm; /* 'shortmess' */
EXTERN char_u *p_sbr; /* 'showbreak' */
EXTERN int p_sc; /* 'showcmd' */
EXTERN int p_sft; /* 'showfulltag' */
EXTERN int p_sm; /* 'showmatch' */
EXTERN int p_smd; /* 'showmode' */
EXTERN long p_ss; /* 'sidescroll' */
EXTERN long p_siso; /* 'sidescrolloff' */
EXTERN int p_scs; /* 'smartcase' */
EXTERN int p_sta; /* 'smarttab' */
EXTERN int p_sb; /* 'splitbelow' */
EXTERN long p_tpm; /* 'tabpagemax' */
EXTERN char_u *p_tal; /* 'tabline' */
EXTERN char_u *p_sps; /* 'spellsuggest' */
EXTERN int p_spr; /* 'splitright' */
EXTERN int p_sol; /* 'startofline' */
EXTERN char_u *p_su; /* 'suffixes' */
EXTERN char_u *p_sws; /* 'swapsync' */
EXTERN char_u *p_swb; /* 'switchbuf' */
EXTERN char_u *p_stl; // 'statusline'
EXTERN int p_sr; // 'shiftround'
EXTERN char_u *p_shm; // 'shortmess'
EXTERN char_u *p_sbr; // 'showbreak'
EXTERN int p_sc; // 'showcmd'
EXTERN int p_sft; // 'showfulltag'
EXTERN int p_sm; // 'showmatch'
EXTERN int p_smd; // 'showmode'
EXTERN long p_ss; // 'sidescroll'
EXTERN long p_siso; // 'sidescrolloff'
EXTERN int p_scs; // 'smartcase'
EXTERN int p_sta; // 'smarttab'
EXTERN int p_sb; // 'splitbelow'
EXTERN long p_tpm; // 'tabpagemax'
EXTERN char_u *p_tal; // 'tabline'
EXTERN char_u *p_sps; // 'spellsuggest'
EXTERN int p_spr; // 'splitright'
EXTERN int p_sol; // 'startofline'
EXTERN char_u *p_su; // 'suffixes'
EXTERN char_u *p_swb; // 'switchbuf'
EXTERN unsigned swb_flags;
#ifdef IN_OPTION_C
static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", NULL};
Expand Down
7 changes: 0 additions & 7 deletions src/nvim/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2296,13 +2296,6 @@ return {
varname='p_swf',
defaults={if_true={vi=true}}
},
{
full_name='swapsync', abbreviation='sws',
type='string', scope={'global'},
vi_def=true,
varname='p_sws',
defaults={if_true={vi="fsync"}}
},
{
full_name='switchbuf', abbreviation='swb',
type='string', list='comma', scope={'global'},
Expand Down

0 comments on commit 62d137c

Please sign in to comment.