2017-11-16 16:35 GMT+03:00 Tim Chase <[email protected]>: > On 2017-11-16 08:03, Christian Brabandt wrote: >> On the other hand, we can not fsync() at the end of the `:g` >> command, because at that time, we would not have a filehandle to >> fsync(). > > I suppose one could gather the file-handles used during the :g > command and then issue one fsync() for each of them when finished. > > Pseudocode something like > > filehandle_set = set() > > def begin_global_command(): > filehandle_set.clear() > > > def deferrable_fsync(fp): > if in_a_global_command(): > filehandle_set.add(fp) > else: > fsync(fp) > > def end_global_command(): > for fp in filehandle_set: > fsync(fp) > filehandle_set.clear() > >> I suppose skipping the fsync() would be okay in this edge case >> for :g command and trust, that the kernel will write the changes to >> disk. The only problem would be a system crash or power failure but >> I believe this is relatively unlikely. > > Alternatively, it might just be enough to document that ":w" also > does an fsync() and might be slow, while writefile() doesn't issue > fsync() and could be faster. For me it was as much the surprise as > anything else.
I do not much like that, when I found that &fsync does not apply to writefile() I wrote a patch (for Neovim). Had to write another one shortly after though: with a new flags that unconditionally disable/enable fsync() call to fight a slowdown for a few plugins where it does matter. > > -tim > > > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
