Re: Re: WAL and commit_delay - Mailing list pgsql-hackers

From ncm@zembu.com (Nathan Myers)
Subject Re: Re: WAL and commit_delay
Date
Msg-id 20010217181319.A16736@store.zembu.com
Whole thread Raw
In response to Re: Re: WAL and commit_delay  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: WAL and commit_delay
List pgsql-hackers
On Sat, Feb 17, 2001 at 07:34:22PM -0500, Tom Lane wrote:
> ncm@zembu.com (Nathan Myers) writes:
> > In the 2.4 kernel it says (fs/buffer.c)
> 
> >    /* this needs further work, at the moment it is identical to fsync() */
> >    down(&inode->i_sem);
> >    err = file->f_op->fsync(file, dentry);
> >    up(&inode->i_sem);
> 
> Hmm, that's the same code that's been there since 2.0 or before.

Indeed.  All xterms look alike, and I used one connected to the wrong box.
Here's what's in 2.4.0:

For fsync:
       filemap_fdatasync(inode->i_mapping);       err = file->f_op->fsync(file, dentry, 0);
filemap_fdatawait(inode->i_mapping);

and for fdatasync:
       filemap_fdatasync(inode->i_mapping);       err = file->f_op->fsync(file, dentry, 1);
filemap_fdatawait(inode->i_mapping);

(Notice the "1" vs. "0" difference?)  So the actual file system 
(ext2fs, reiserfs, etc.) has the option of equating the two, or not.  
In fs/ext2/fsync.c, we have
 int ext2_fsync_inode(struct inode *inode, int datasync) {       int err;       err  = fsync_inode_buffers(inode);
if (!(inode->i_state & I_DIRTY))               return err;       if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
            return err;       err |= ext2_sync_inode(inode);       return err ? -EIO : 0; }
 

I.e. yes, Linux 2.4.0 and ext2 do implement the distinction.
Sorry for the misinformation.

Nathan Myers
ncm@zembu.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: WAL and commit_delay
Next
From: Tom Lane
Date:
Subject: Re: Re: WAL and commit_delay