diff options
| author | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-05-02 14:25:08 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-03 01:23:53 -0400 |
| commit | 1c6278295d6482edaaaef5faa64b18f17b3319b7 (patch) | |
| tree | 226896c455d8a4996527c4a0ec5699956c657ec3 | |
| parent | 7fab479bebb96b1b4888bdae9b42e1fa9c5d3f38 (diff) | |
[PATCH] JFS: Write journal sync points more often
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>
| -rw-r--r-- | fs/jfs/jfs_logmgr.c | 17 | ||||
| -rw-r--r-- | fs/jfs/jfs_logmgr.h | 1 | ||||
| -rw-r--r-- | fs/jfs/jfs_txnmgr.c | 14 | ||||
| -rw-r--r-- | fs/jfs/super.c | 4 |
4 files changed, 27 insertions, 9 deletions
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index cfcdad3459dd..dfa1200daa61 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
| @@ -927,9 +927,8 @@ static void lmPostGC(struct lbuf * bp) | |||
| 927 | * calculate new value of i_nextsync which determines when | 927 | * calculate new value of i_nextsync which determines when |
| 928 | * this code is called again. | 928 | * this code is called again. |
| 929 | * | 929 | * |
| 930 | * this is called only from lmLog(). | 930 | * PARAMETERS: log - log structure |
| 931 | * | 931 | * nosyncwait - 1 if called asynchronously |
| 932 | * PARAMETER: ip - pointer to logs inode. | ||
| 933 | * | 932 | * |
| 934 | * RETURN: 0 | 933 | * RETURN: 0 |
| 935 | * | 934 | * |
| @@ -1051,6 +1050,18 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) | |||
| 1051 | return lsn; | 1050 | return lsn; |
| 1052 | } | 1051 | } |
| 1053 | 1052 | ||
| 1053 | /* | ||
| 1054 | * NAME: jfs_syncpt | ||
| 1055 | * | ||
| 1056 | * FUNCTION: write log SYNCPT record for specified log | ||
| 1057 | * | ||
| 1058 | * PARAMETERS: log - log structure | ||
| 1059 | */ | ||
| 1060 | void jfs_syncpt(struct jfs_log *log) | ||
| 1061 | { LOG_LOCK(log); | ||
| 1062 | lmLogSync(log, 1); | ||
| 1063 | LOG_UNLOCK(log); | ||
| 1064 | } | ||
| 1054 | 1065 | ||
| 1055 | /* | 1066 | /* |
| 1056 | * NAME: lmLogOpen() | 1067 | * NAME: lmLogOpen() |
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h index f4c121098d4f..51291fbc420c 100644 --- a/fs/jfs/jfs_logmgr.h +++ b/fs/jfs/jfs_logmgr.h | |||
| @@ -508,5 +508,6 @@ extern int lmLogShutdown(struct jfs_log * log); | |||
| 508 | extern int lmLogInit(struct jfs_log * log); | 508 | extern int lmLogInit(struct jfs_log * log); |
| 509 | extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); | 509 | extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); |
| 510 | extern void jfs_flush_journal(struct jfs_log * log, int wait); | 510 | extern void jfs_flush_journal(struct jfs_log * log, int wait); |
| 511 | extern void jfs_syncpt(struct jfs_log *log); | ||
| 511 | 512 | ||
| 512 | #endif /* _H_JFS_LOGMGR */ | 513 | #endif /* _H_JFS_LOGMGR */ |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index bbc9c1407b55..e93d01aa12c4 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
| @@ -567,9 +567,6 @@ void txEnd(tid_t tid) | |||
| 567 | * synchronize with logsync barrier | 567 | * synchronize with logsync barrier |
| 568 | */ | 568 | */ |
| 569 | if (test_bit(log_SYNCBARRIER, &log->flag)) { | 569 | if (test_bit(log_SYNCBARRIER, &log->flag)) { |
| 570 | /* forward log syncpt */ | ||
| 571 | /* lmSync(log); */ | ||
| 572 | |||
| 573 | jfs_info("log barrier off: 0x%x", log->lsn); | 570 | jfs_info("log barrier off: 0x%x", log->lsn); |
| 574 | 571 | ||
| 575 | /* enable new transactions start */ | 572 | /* enable new transactions start */ |
| @@ -577,15 +574,22 @@ void txEnd(tid_t tid) | |||
| 577 | 574 | ||
| 578 | /* wakeup all waitors for logsync barrier */ | 575 | /* wakeup all waitors for logsync barrier */ |
| 579 | TXN_WAKEUP(&log->syncwait); | 576 | TXN_WAKEUP(&log->syncwait); |
| 577 | |||
| 578 | TXN_UNLOCK(); | ||
| 579 | |||
| 580 | /* forward log syncpt */ | ||
| 581 | jfs_syncpt(log); | ||
| 582 | |||
| 583 | goto wakeup; | ||
| 580 | } | 584 | } |
| 581 | } | 585 | } |
| 582 | 586 | ||
| 587 | TXN_UNLOCK(); | ||
| 588 | wakeup: | ||
| 583 | /* | 589 | /* |
| 584 | * wakeup all waitors for a free tblock | 590 | * wakeup all waitors for a free tblock |
| 585 | */ | 591 | */ |
| 586 | TXN_WAKEUP(&TxAnchor.freewait); | 592 | TXN_WAKEUP(&TxAnchor.freewait); |
| 587 | |||
| 588 | TXN_UNLOCK(); | ||
| 589 | } | 593 | } |
| 590 | 594 | ||
| 591 | 595 | ||
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 0812005364a1..5e774ed7fb64 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
| @@ -558,8 +558,10 @@ static int jfs_sync_fs(struct super_block *sb, int wait) | |||
| 558 | struct jfs_log *log = JFS_SBI(sb)->log; | 558 | struct jfs_log *log = JFS_SBI(sb)->log; |
| 559 | 559 | ||
| 560 | /* log == NULL indicates read-only mount */ | 560 | /* log == NULL indicates read-only mount */ |
| 561 | if (log) | 561 | if (log) { |
| 562 | jfs_flush_journal(log, wait); | 562 | jfs_flush_journal(log, wait); |
| 563 | jfs_syncpt(log); | ||
| 564 | } | ||
| 563 | 565 | ||
| 564 | return 0; | 566 | return 0; |
| 565 | } | 567 | } |
