···82 */8384/*0000000000000000000000000085 * start_this_handle: Given a handle, deal with any locking or stalling86 * needed to make sure that there is enough journal space for the handle87 * to begin. Attach the handle to a transaction and set up the···121 int needed;122 int nblocks = handle->h_buffer_credits;123 transaction_t *new_transaction = NULL;124- unsigned long ts = jiffies;125126 if (nblocks > journal->j_max_transaction_buffers) {127 printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n",···266267 /* OK, account for the buffers that this operation expects to268 * use and add the handle to the running transaction. 269- *270- * In order for t_max_wait to be reliable, it must be271- * protected by a lock. But doing so will mean that272- * start_this_handle() can not be run in parallel on SMP273- * systems, which limits our scalability. So we only enable274- * it when debugging is enabled. We may want to use a275- * separate flag, eventually, so we can enable this276- * independently of debugging.277 */278-#ifdef CONFIG_JBD2_DEBUG279- if (jbd2_journal_enable_debug &&280- time_after(transaction->t_start, ts)) {281- ts = jbd2_time_diff(ts, transaction->t_start);282- spin_lock(&transaction->t_handle_lock);283- if (ts > transaction->t_max_wait)284- transaction->t_max_wait = ts;285- spin_unlock(&transaction->t_handle_lock);286- }287-#endif288 handle->h_transaction = transaction;289 atomic_inc(&transaction->t_updates);290 atomic_inc(&transaction->t_handle_count);
···82 */8384/*85+ * Update transiaction's maximum wait time, if debugging is enabled.86+ *87+ * In order for t_max_wait to be reliable, it must be protected by a88+ * lock. But doing so will mean that start_this_handle() can not be89+ * run in parallel on SMP systems, which limits our scalability. So90+ * unless debugging is enabled, we no longer update t_max_wait, which91+ * means that maximum wait time reported by the jbd2_run_stats92+ * tracepoint will always be zero.93+ */94+static inline void update_t_max_wait(transaction_t *transaction)95+{96+#ifdef CONFIG_JBD2_DEBUG97+ unsigned long ts = jiffies;98+99+ if (jbd2_journal_enable_debug &&100+ time_after(transaction->t_start, ts)) {101+ ts = jbd2_time_diff(ts, transaction->t_start);102+ spin_lock(&transaction->t_handle_lock);103+ if (ts > transaction->t_max_wait)104+ transaction->t_max_wait = ts;105+ spin_unlock(&transaction->t_handle_lock);106+ }107+#endif108+}109+110+/*111 * start_this_handle: Given a handle, deal with any locking or stalling112 * needed to make sure that there is enough journal space for the handle113 * to begin. Attach the handle to a transaction and set up the···95 int needed;96 int nblocks = handle->h_buffer_credits;97 transaction_t *new_transaction = NULL;09899 if (nblocks > journal->j_max_transaction_buffers) {100 printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n",···241242 /* OK, account for the buffers that this operation expects to243 * use and add the handle to the running transaction. 00000000244 */245+ update_t_max_wait(transaction);000000000246 handle->h_transaction = transaction;247 atomic_inc(&transaction->t_updates);248 atomic_inc(&transaction->t_handle_count);