]> git.hungrycats.org Git - linux/commitdiff
JFS: Make sure journal records get flushed to disk
authorDave Kleikamp <shaggy@shaggy.austin.ibm.com>
Wed, 1 Oct 2003 11:35:09 +0000 (06:35 -0500)
committerDave Kleikamp <shaggy@shaggy.austin.ibm.com>
Wed, 1 Oct 2003 11:35:09 +0000 (06:35 -0500)
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.

fs/jfs/file.c
fs/jfs/inode.c

index cfc55c2d230abccad3151b21fc4e20fbdc7726aa..67e4ba8ce0956c51715c85f656cf5d602b6d99a6 100644 (file)
@@ -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);
 
index 989621a380b6aceca0a5932019111b9759856cb8..53e25c4a4dbeac18ef055a11d126b18fba3bc6c9 100644 (file)
@@ -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!");