···8282 */83838484/*8585+ * Update transiaction's maximum wait time, if debugging is enabled.8686+ *8787+ * In order for t_max_wait to be reliable, it must be protected by a8888+ * lock. But doing so will mean that start_this_handle() can not be8989+ * run in parallel on SMP systems, which limits our scalability. So9090+ * unless debugging is enabled, we no longer update t_max_wait, which9191+ * means that maximum wait time reported by the jbd2_run_stats9292+ * tracepoint will always be zero.9393+ */9494+static inline void update_t_max_wait(transaction_t *transaction)9595+{9696+#ifdef CONFIG_JBD2_DEBUG9797+ unsigned long ts = jiffies;9898+9999+ if (jbd2_journal_enable_debug &&100100+ time_after(transaction->t_start, ts)) {101101+ ts = jbd2_time_diff(ts, transaction->t_start);102102+ spin_lock(&transaction->t_handle_lock);103103+ if (ts > transaction->t_max_wait)104104+ transaction->t_max_wait = ts;105105+ spin_unlock(&transaction->t_handle_lock);106106+ }107107+#endif108108+}109109+110110+/*85111 * start_this_handle: Given a handle, deal with any locking or stalling86112 * needed to make sure that there is enough journal space for the handle87113 * to begin. Attach the handle to a transaction and set up the···12195 int needed;12296 int nblocks = handle->h_buffer_credits;12397 transaction_t *new_transaction = NULL;124124- unsigned long ts = jiffies;1259812699 if (nblocks > journal->j_max_transaction_buffers) {127100 printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n",···266241267242 /* OK, account for the buffers that this operation expects to268243 * use and add the handle to the running transaction. 269269- *270270- * In order for t_max_wait to be reliable, it must be271271- * protected by a lock. But doing so will mean that272272- * start_this_handle() can not be run in parallel on SMP273273- * systems, which limits our scalability. So we only enable274274- * it when debugging is enabled. We may want to use a275275- * separate flag, eventually, so we can enable this276276- * independently of debugging.277244 */278278-#ifdef CONFIG_JBD2_DEBUG279279- if (jbd2_journal_enable_debug &&280280- time_after(transaction->t_start, ts)) {281281- ts = jbd2_time_diff(ts, transaction->t_start);282282- spin_lock(&transaction->t_handle_lock);283283- if (ts > transaction->t_max_wait)284284- transaction->t_max_wait = ts;285285- spin_unlock(&transaction->t_handle_lock);286286- }287287-#endif245245+ update_t_max_wait(transaction);288246 handle->h_transaction = transaction;289247 atomic_inc(&transaction->t_updates);290248 atomic_inc(&transaction->t_handle_count);