On Sat, Feb 17, 2001 at 07:34:22PM -0500, Tom Lane wrote:
> [EMAIL PROTECTED] (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
[EMAIL PROTECTED]