From 816046efa6bb17875ca550c816ef1ae00ae5e6d6 Mon Sep 17 00:00:00 2001 From: Dave Kleikamp Date: Wed, 1 Oct 2003 06:35:09 -0500 Subject: [PATCH] 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. --- fs/jfs/file.c | 8 +++++--- fs/jfs/inode.c | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/jfs/file.c b/fs/jfs/file.c index cfc55c2d230ab..67e4ba8ce0956 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c @@ -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); diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 989621a380b6a..53e25c4a4dbea 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -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!"); -- 2.53.0