[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vim file write mode on journaling fs.




Andi Kleen wrote:

> On Sat, Aug 11, 2001 at 08:48:01PM +0200, Bram Moolenaar wrote:
> > What tools do I have that indicate to the FS how it should handle the data
> > I have written?  Can I somehow tell it to flush my data soon, but not as
> > drastic as syncing?
> 
> You could use fsync before the close. Then the write will be async, but at
> the end there is a flush forced. This should also give you efficient 
> extent allocation on XFS. For ext2 you should also fdatasync the directory
> to make sure that the filename really has reached disk and won't hit
> lost+found.

I don't like the idea of an application having to fsync() every file that it
has written and wants to avoid that it gets lost in a crash.  In my opinion
it's not the task of the application to decide that it's time to flush data to
the disk.  Only applications that must know for sure that the data has been
written (such as when receiving e-mail, where the protocol requires it).
After all, you would want settings in the filesystem for tuning the
performance, not settings in every application that uses this filesystem.

> BTW while at it you could also make vim use rename+unlink of the old file 
> instead of O_TRUNC for file writing, then it would do COW in hardlinked
> trees, not requiring me to keep a clumpsy wrapper around for that.

I don't understand this remark.  Perhaps the 'backupcopy' option is what you
need?  It's new in Vim 6.0.

-- 
-rwxr-xr-x  1 root          24 Oct 29  1929 /bin/ed
-rwxr-xr-t  4 root      131720 Jan  1  1970 /usr/ucb/vi
-rwxr-xr-x  1 root  5.89824e37 Oct 22  1990 /usr/bin/emacs

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
(((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///