]> err.no Git - linux-2.6/commitdiff
[PATCH] JFS: Write journal sync points more often
authorDave Kleikamp <shaggy@austin.ibm.com>
Mon, 2 May 2005 18:25:08 +0000 (12:25 -0600)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 3 May 2005 05:23:53 +0000 (22:23 -0700)
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 <shaggy@austin.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/jfs/jfs_logmgr.c
fs/jfs/jfs_logmgr.h
fs/jfs/jfs_txnmgr.c
fs/jfs/super.c

index cfcdad3459ddfb5b641f8bd9b3bca6054e0e4e3a..dfa1200daa61c22f6b96bdff1130d88090a25006 100644 (file)
@@ -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 * log, int nosyncwait)
        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()
index f4c121098d4f38530e66f36af45097683ad9ea58..51291fbc420c6c1b73cecd20edeeb526ea0fd4d1 100644 (file)
@@ -508,5 +508,6 @@ extern int lmLogShutdown(struct jfs_log * 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 */
index bbc9c1407b552d808777f7b09c22b7148923b8fa..e93d01aa12c46da06501af64375918b2879e7805 100644 (file)
@@ -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();
 }
 
 
index 0812005364a17a1757d9674ae5af66672f2067cf..5e774ed7fb647d7b5ded82f414f5b0056e8a1dcf 100644 (file)
@@ -558,8 +558,10 @@ static int jfs_sync_fs(struct super_block *sb, int wait)
        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;
 }