From 8b9dcc253d3e305513a7f9271537492290aacdce Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 28 Jul 2003 16:37:31 +0000 Subject: [PATCH] merge b_devel into b_filterio --- .../kernel_patches/patches/jbd-commit-tricks.patch | 132 +++++++++++++++++++++ .../patches/jbd-dont-account-blocks-twice.patch | 17 +++ lustre/kernel_patches/pc/jbd-commit-tricks.pc | 4 + .../pc/jbd-dont-account-blocks-twice.pc | 1 + lustre/tests/Makefile.mk | 3 +- 5 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 lustre/kernel_patches/patches/jbd-commit-tricks.patch create mode 100644 lustre/kernel_patches/patches/jbd-dont-account-blocks-twice.patch create mode 100644 lustre/kernel_patches/pc/jbd-commit-tricks.pc create mode 100644 lustre/kernel_patches/pc/jbd-dont-account-blocks-twice.pc diff --git a/lustre/kernel_patches/patches/jbd-commit-tricks.patch b/lustre/kernel_patches/patches/jbd-commit-tricks.patch new file mode 100644 index 0000000..467c29f --- /dev/null +++ b/lustre/kernel_patches/patches/jbd-commit-tricks.patch @@ -0,0 +1,132 @@ + +--- linux-2.4.18/fs/jbd/checkpoint.c~jbd-commit-tricks Mon Jul 28 13:52:05 2003 ++++ linux-2.4.18-alexey/fs/jbd/checkpoint.c Mon Jul 28 14:03:59 2003 +@@ -77,19 +77,23 @@ static int __try_to_free_cp_buf(struct j + * to wait for a checkpoint to free up some space in the log. + */ + +-void log_wait_for_space(journal_t *journal, int nblocks) ++void log_wait_for_space(journal_t *journal) + { ++ int nblocks; ++ ++ nblocks = jbd_space_needed(journal); + while (log_space_left(journal) < nblocks) { + if (journal->j_flags & JFS_ABORT) + return; + unlock_journal(journal); + down(&journal->j_checkpoint_sem); + lock_journal(journal); ++ nblocks = jbd_space_needed(journal); + + /* Test again, another process may have checkpointed + * while we were waiting for the checkpoint lock */ + if (log_space_left(journal) < nblocks) { +- log_do_checkpoint(journal, nblocks); ++ log_do_checkpoint(journal); + } + up(&journal->j_checkpoint_sem); + } +@@ -260,8 +264,7 @@ static int __flush_buffer(journal_t *jou + * The journal should be locked before calling this function. + */ + +-/* @@@ `nblocks' is unused. Should it be used? */ +-int log_do_checkpoint (journal_t *journal, int nblocks) ++int log_do_checkpoint (journal_t *journal) + { + transaction_t *transaction, *last_transaction, *next_transaction; + int result; +@@ -315,6 +318,8 @@ repeat: + retry = __flush_buffer(journal, jh, bhs, &batch_count, + &drop_count); + } while (jh != last_jh && !retry); ++ if (journal->j_checkpoint_transactions != transaction) ++ goto done; + if (batch_count) { + __flush_batch(bhs, &batch_count); + goto repeat; +@@ -328,6 +333,8 @@ repeat: + */ + cleanup_ret = __cleanup_transaction(journal, transaction); + J_ASSERT(drop_count != 0 || cleanup_ret != 0); ++ if (journal->j_checkpoint_transactions != transaction) ++ goto done; + goto repeat; /* __cleanup may have dropped lock */ + } while (transaction != last_transaction); + +--- linux-2.4.18/fs/jbd/journal.c~jbd-commit-tricks Mon Jul 28 13:52:05 2003 ++++ linux-2.4.18-alexey/fs/jbd/journal.c Mon Jul 28 14:03:59 2003 +@@ -1115,7 +1115,7 @@ void journal_destroy (journal_t *journal + /* Force any old transactions to disk */ + lock_journal(journal); + while (journal->j_checkpoint_transactions != NULL) +- log_do_checkpoint(journal, 1); ++ log_do_checkpoint(journal); + + J_ASSERT(journal->j_running_transaction == NULL); + J_ASSERT(journal->j_committing_transaction == NULL); +@@ -1302,7 +1302,7 @@ int journal_flush (journal_t *journal) + /* ...and flush everything in the log out to disk. */ + lock_journal(journal); + while (!err && journal->j_checkpoint_transactions != NULL) +- err = log_do_checkpoint(journal, journal->j_maxlen); ++ err = log_do_checkpoint(journal); + cleanup_journal_tail(journal); + + /* Finally, mark the journal as really needing no recovery. +--- linux-2.4.18/fs/jbd/transaction.c~jbd-commit-tricks Mon Jul 28 13:52:05 2003 ++++ linux-2.4.18-alexey/fs/jbd/transaction.c Mon Jul 28 14:03:59 2003 +@@ -182,14 +182,9 @@ repeat_locked: + * Also, this test is inconsitent with the matching one in + * journal_extend(). + */ +- needed = journal->j_max_transaction_buffers; +- if (journal->j_committing_transaction) +- needed += journal->j_committing_transaction-> +- t_outstanding_credits; +- +- if (log_space_left(journal) < needed) { ++ if (log_space_left(journal) < jbd_space_needed(journal)) { + jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle); +- log_wait_for_space(journal, needed); ++ log_wait_for_space(journal); + goto repeat_locked; + } + +--- linux-2.4.18/include/linux/jbd.h~jbd-commit-tricks Mon Jul 28 13:52:17 2003 ++++ linux-2.4.18-alexey/include/linux/jbd.h Mon Jul 28 14:03:59 2003 +@@ -740,9 +740,9 @@ extern void journal_brelse_array(stru + extern int log_space_left (journal_t *); /* Called with journal locked */ + extern tid_t log_start_commit (journal_t *, transaction_t *); + extern void log_wait_commit (journal_t *, tid_t); +-extern int log_do_checkpoint (journal_t *, int); ++extern int log_do_checkpoint (journal_t *); + +-extern void log_wait_for_space(journal_t *, int nblocks); ++extern void log_wait_for_space(journal_t *); + extern void __journal_drop_transaction(journal_t *, transaction_t *); + extern int cleanup_journal_tail(journal_t *); + +@@ -815,6 +815,19 @@ static inline int tid_geq(tid_t x, tid_t + } + + 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 + +_ diff --git a/lustre/kernel_patches/patches/jbd-dont-account-blocks-twice.patch b/lustre/kernel_patches/patches/jbd-dont-account-blocks-twice.patch new file mode 100644 index 0000000..d1be6f02 --- /dev/null +++ b/lustre/kernel_patches/patches/jbd-dont-account-blocks-twice.patch @@ -0,0 +1,17 @@ + +--- linux-2.4.18/fs/jbd/commit.c~jbd-dont-account-blocks-twice Mon Jul 28 13:52:05 2003 ++++ linux-2.4.18-alexey/fs/jbd/commit.c Mon Jul 28 14:03:53 2003 +@@ -407,6 +407,11 @@ sync_datalist_empty: + continue; + } + ++ /* start_this_handle() accounts t_outstanding_credits ++ * to know free space in log, but this counter is changed ++ * by journal_next_log_block() also. */ ++ commit_transaction->t_outstanding_credits--; ++ + /* Bump b_count to prevent truncate from stumbling over + the shadowed buffer! @@@ This can go if we ever get + rid of the BJ_IO/BJ_Shadow pairing of buffers. */ + +_ diff --git a/lustre/kernel_patches/pc/jbd-commit-tricks.pc b/lustre/kernel_patches/pc/jbd-commit-tricks.pc new file mode 100644 index 0000000..4d39a5a --- /dev/null +++ b/lustre/kernel_patches/pc/jbd-commit-tricks.pc @@ -0,0 +1,4 @@ +fs/jbd/checkpoint.c +fs/jbd/journal.c +fs/jbd/transaction.c +include/linux/jbd.h diff --git a/lustre/kernel_patches/pc/jbd-dont-account-blocks-twice.pc b/lustre/kernel_patches/pc/jbd-dont-account-blocks-twice.pc new file mode 100644 index 0000000..b53eee4 --- /dev/null +++ b/lustre/kernel_patches/pc/jbd-dont-account-blocks-twice.pc @@ -0,0 +1 @@ +fs/jbd/commit.c diff --git a/lustre/tests/Makefile.mk b/lustre/tests/Makefile.mk index 3b4dda3..b0106ac 100644 --- a/lustre/tests/Makefile.mk +++ b/lustre/tests/Makefile.mk @@ -11,7 +11,7 @@ host-progs := openunlink testreq truncate directio openme writeme open_delay \ stat createmany statmany multifstat createtest mlink \ opendirunlink opendevunlink unlinkmany fchdir_test \ checkstat wantedi statone runas openfile \ - mcreate mkdirmany utime o_directory small_write + mcreate mkdirmany utime o_directory small_write multiop always := $(host-progs) @@ -50,3 +50,4 @@ fchdir_test-objs :=fchdir_test.o utime-objs :=utime.o o_directory-objs :=o_directory.o small_write-objs :=small_write.o +multiop-objs :=multiop.o -- 1.8.3.1