fs/jbd2/transaction.c | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index d95cc9d..037d65d 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -81,6 +81,23 @@ jbd2_get_transaction(journal_t *journal, transaction_t *transaction) * of that one update. */ +static inline void start_handle_debug(transaction_t *transaction) +{ +#ifdef CONFIG_JBD2_DEBUG + unsigned long ts = jiffies; + + if (jbd2_journal_enable_debug && + time_after(transaction->t_start, ts)) { + ts = jbd2_time_diff(ts, transaction->t_start); + spin_lock(&transaction->t_handle_lock); + if (ts > transaction->t_max_wait) + transaction->t_max_wait = ts; + spin_unlock(&transaction->t_handle_lock); + } +#endif +} + + /* * start_this_handle: Given a handle, deal with any locking or stalling * needed to make sure that there is enough journal space for the handle @@ -95,7 +112,6 @@ static int start_this_handle(journal_t *journal, handle_t *handle, int needed; int nblocks = handle->h_buffer_credits; transaction_t *new_transaction = NULL; - unsigned long ts = jiffies; if (nblocks > journal->j_max_transaction_buffers) { printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n", @@ -250,16 +266,7 @@ repeat: * separate flag, eventually, so we can enable this * independently of debugging. */ -#ifdef CONFIG_JBD2_DEBUG - if (jbd2_journal_enable_debug && - time_after(transaction->t_start, ts)) { - ts = jbd2_time_diff(ts, transaction->t_start); - spin_lock(&transaction->t_handle_lock); - if (ts > transaction->t_max_wait) - transaction->t_max_wait = ts; - spin_unlock(&transaction->t_handle_lock); - } -#endif + start_handle_debug(transaction); handle->h_transaction = transaction; atomic_inc(&transaction->t_updates); atomic_inc(&transaction->t_handle_count);