diff options
| author | Andrew Morton <akpm@osdl.org> | 2003-07-10 10:03:57 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-10 10:03:57 -0700 |
| commit | a2df663dc232c8cba14806f57e23fe0296be0832 (patch) | |
| tree | e1214ed1745a2a5f357d1750a7b98a95acb27d5b /include/linux/jbd.h | |
| parent | 20c52ab8763f4218d6515db11a0eb306b0d317aa (diff) | |
[PATCH] JBD: checkpointing optimisations
From: Alex Tomas <bzzz@tmi.comex.ru>
Some transaction checkpointing improvements for the JBD commit phase. Decent
speedups:
creation of 500K files in single dir (with htree, of course):
before: 4m16.094s, 4m12.035s, 4m11.911s
after: 1m41.364s, 1m43.461s, 1m45.189s
removal of 500K files in single dir:
before: 43m50.161s
after: 38m45.510s
- Make __log_wait_for_space() recalculate the needed blocks because journal
free space changes during commit
- Make log_do_checkpoint() starts scanning from the oldest transaction
- Make log_do_checkpoint() stop scanning if a transaction gets dropped.
The caller will reevaluate the transaction state and decide whether more
space needs to be generated in the log.
The effect of this is to smooth out the I/O patterns, avoid the huge
stop-and-go which currently happens when forced checkpointing writes out
and waits upon 3/4 of the journal's size worth of data.
Diffstat (limited to 'include/linux/jbd.h')
| -rw-r--r-- | include/linux/jbd.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 42d0caccf7e5..eb154bafe1e4 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -992,9 +992,9 @@ int log_start_commit(journal_t *journal, tid_t tid); int __log_start_commit(journal_t *journal, tid_t tid); int journal_start_commit(journal_t *journal, tid_t *tid); int log_wait_commit(journal_t *journal, tid_t tid); -int log_do_checkpoint(journal_t *journal, int nblocks); +int log_do_checkpoint(journal_t *journal); -void __log_wait_for_space(journal_t *journal, int nblocks); +void __log_wait_for_space(journal_t *journal); extern void __journal_drop_transaction(journal_t *, transaction_t *); extern int cleanup_journal_tail(journal_t *); @@ -1054,6 +1054,19 @@ static inline int tid_geq(tid_t x, tid_t y) extern int journal_blocks_per_page(struct inode *inode); /* + * Return the minimum number of blocks which must be free in the journal + * before a new transaction may be started. Must be called under j_state_lock. + */ +static inline int jbd_space_needed(journal_t *journal) +{ + int nblocks = journal->j_max_transaction_buffers; + if (journal->j_committing_transaction) + nblocks += journal->j_committing_transaction-> + t_outstanding_credits; + return nblocks; +} + +/* * Definitions which augment the buffer_head layer */ |
