struct inode *inode = dentry->d_inode;
int rc = 0;
- if (!(inode->i_state & I_DIRTY))
- return rc;
- if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
+ if (!(inode->i_state & I_DIRTY) ||
+ (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) {
+ /* Make sure committed changes hit the disk */
+ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1);
return rc;
+ }
rc |= jfs_commit_inode(inode, 1);
void jfs_write_inode(struct inode *inode, int wait)
{
+ if (test_cflag(COMMIT_Nolink, inode))
+ return;
/*
* If COMMIT_DIRTY is not set, the inode isn't really dirty.
* It has been committed since the last change, but was still
- * on the dirty inode list
+ * on the dirty inode list.
*/
- if (test_cflag(COMMIT_Nolink, inode) ||
- !test_cflag(COMMIT_Dirty, inode))
+ if (!test_cflag(COMMIT_Dirty, inode)) {
+ /* Make sure committed changes hit the disk */
+ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait);
return;
+ }
if (jfs_commit_inode(inode, wait)) {
jfs_err("jfs_write_inode: jfs_commit_inode failed!");