Commit 816046ef authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: Make sure journal records get flushed to disk

A performance enhancement that reduced the number of partial-page journal
writes resulted in some journal records staying in cache indefinately.  We
need to make sure that these records are written in a timely fashion.
parent 1ced4444
......@@ -34,10 +34,12 @@ int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
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);
......
......@@ -107,14 +107,18 @@ int jfs_commit_inode(struct inode *inode, int wait)
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!");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment