int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) { struct inode *inode = dentry->d_inode; int ret; J_ASSERT(ext3_journal_current_handle() == 0); /* * fsync_inode_buffers() just walks i_dirty_buffers and waits * on them. It's a no-op for full data journalling because * i_dirty_buffers will be ampty. * Really, we only need to start I/O on the dirty buffers - * we'll end up waiting on them in commit. */ ret = fsync_inode_buffers(inode); /* In writeback mode, we need to force out data buffers too. In * the other modes, ext3_force_commit takes care of forcing out * just the right data blocks. */ if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) ret |= fsync_inode_data_buffers(inode); ext3_force_commit(inode->i_sb); return ret; }
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; }
/* Sync a reiserfs file. */ static int reiserfs_sync_file( struct file * p_s_filp, struct dentry * p_s_dentry, int datasync ) { struct inode * p_s_inode = p_s_dentry->d_inode; int n_err; lock_kernel() ; if (!S_ISREG(p_s_inode->i_mode)) BUG (); n_err = fsync_inode_buffers(p_s_inode) ; n_err |= fsync_inode_data_buffers(p_s_inode); reiserfs_commit_for_inode(p_s_inode) ; unlock_kernel() ; return ( n_err < 0 ) ? -EIO : 0; }