From: Dave Kleikamp This patch adds jfs_syncpt, which calls lmLogSync to write sync points to the journal both in jfs_sync_fs and when sync barrier processing completes. lmLogSync accomplishes two things: 1) it pushes logged-but-dirty metadata pages to disk, and 2) it writes a sync record to the journal so that jfs_fsck doesn't need to replay more transactions than is necessary. Signed-off-by: Dave Kleikamp Signed-off-by: Andrew Morton --- fs/jfs/jfs_logmgr.c | 17 ++++++++++++++--- fs/jfs/jfs_logmgr.h | 1 + fs/jfs/jfs_txnmgr.c | 14 +++++++++----- fs/jfs/super.c | 4 +++- 4 files changed, 27 insertions(+), 9 deletions(-) diff -puN fs/jfs/jfs_logmgr.c~jfs-write-journal-sync-points-more-often fs/jfs/jfs_logmgr.c --- 25/fs/jfs/jfs_logmgr.c~jfs-write-journal-sync-points-more-often Thu Apr 28 17:00:13 2005 +++ 25-akpm/fs/jfs/jfs_logmgr.c Thu Apr 28 17:00:13 2005 @@ -927,9 +927,8 @@ static void lmPostGC(struct lbuf * bp) * calculate new value of i_nextsync which determines when * this code is called again. * - * this is called only from lmLog(). - * - * PARAMETER: ip - pointer to logs inode. + * PARAMETERS: log - log structure + * nosyncwait - 1 if called asynchronously * * RETURN: 0 * @@ -1051,6 +1050,18 @@ static int lmLogSync(struct jfs_log * lo return lsn; } +/* + * NAME: jfs_syncpt + * + * FUNCTION: write log SYNCPT record for specified log + * + * PARAMETERS: log - log structure + */ +void jfs_syncpt(struct jfs_log *log) +{ LOG_LOCK(log); + lmLogSync(log, 1); + LOG_UNLOCK(log); +} /* * NAME: lmLogOpen() diff -puN fs/jfs/jfs_logmgr.h~jfs-write-journal-sync-points-more-often fs/jfs/jfs_logmgr.h --- 25/fs/jfs/jfs_logmgr.h~jfs-write-journal-sync-points-more-often Thu Apr 28 17:00:13 2005 +++ 25-akpm/fs/jfs/jfs_logmgr.h Thu Apr 28 17:00:13 2005 @@ -508,5 +508,6 @@ extern int lmLogShutdown(struct jfs_log extern int lmLogInit(struct jfs_log * log); extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); extern void jfs_flush_journal(struct jfs_log * log, int wait); +extern void jfs_syncpt(struct jfs_log *log); #endif /* _H_JFS_LOGMGR */ diff -puN fs/jfs/jfs_txnmgr.c~jfs-write-journal-sync-points-more-often fs/jfs/jfs_txnmgr.c --- 25/fs/jfs/jfs_txnmgr.c~jfs-write-journal-sync-points-more-often Thu Apr 28 17:00:13 2005 +++ 25-akpm/fs/jfs/jfs_txnmgr.c Thu Apr 28 17:00:13 2005 @@ -567,9 +567,6 @@ void txEnd(tid_t tid) * synchronize with logsync barrier */ if (test_bit(log_SYNCBARRIER, &log->flag)) { - /* forward log syncpt */ - /* lmSync(log); */ - jfs_info("log barrier off: 0x%x", log->lsn); /* enable new transactions start */ @@ -577,15 +574,22 @@ void txEnd(tid_t tid) /* wakeup all waitors for logsync barrier */ TXN_WAKEUP(&log->syncwait); + + TXN_UNLOCK(); + + /* forward log syncpt */ + jfs_syncpt(log); + + goto wakeup; } } + TXN_UNLOCK(); +wakeup: /* * wakeup all waitors for a free tblock */ TXN_WAKEUP(&TxAnchor.freewait); - - TXN_UNLOCK(); } diff -puN fs/jfs/super.c~jfs-write-journal-sync-points-more-often fs/jfs/super.c --- 25/fs/jfs/super.c~jfs-write-journal-sync-points-more-often Thu Apr 28 17:00:13 2005 +++ 25-akpm/fs/jfs/super.c Thu Apr 28 17:00:13 2005 @@ -558,8 +558,10 @@ static int jfs_sync_fs(struct super_bloc struct jfs_log *log = JFS_SBI(sb)->log; /* log == NULL indicates read-only mount */ - if (log) + if (log) { jfs_flush_journal(log, wait); + jfs_syncpt(log); + } return 0; } _