[PATCH] Make sure journal records get flushed to disk (1 of 2)
Dave Kleikamp <[email protected]> Fri, 24 Oct 2003 09:39:09 -0500
| Newsgroups | gmane.comp.file-systems.jfs.patches |
|---|---|
| Message-ID | <[email protected]> |
# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1148 -> 1.1149 # fs/jfs/inode.c 1.14 -> 1.15 # fs/jfs/file.c 1.10 -> 1.11 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/10/01 [email protected] 1.1149 # 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. # -------------------------------------------- # diff -Nru a/fs/jfs/file.c b/fs/jfs/file.c --- a/fs/jfs/file.c Fri Oct 24 09:30:33 2003 +++ b/fs/jfs/file.c Fri Oct 24 09:30:33 2003 @@ -39,10 +39,12 @@ rc = fsync_inode_data_buffers(inode); - 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 -Nru a/fs/jfs/inode.c b/fs/jfs/inode.c --- a/fs/jfs/inode.c Fri Oct 24 09:30:33 2003 +++ b/fs/jfs/inode.c Fri Oct 24 09:30:33 2003 @@ -154,14 +154,18 @@ 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!");