/* Preconditions: The journal MUST be locked. We don't perform atomic mallocs on the new transaction and we can't block without protecting against other processes trying to touch the journal while it is in transition.  */
static transaction_t* jbd2_get_transaction(journal_t *journal, transaction_t *transaction)
/* Preconditions: The journal MUST be locked. We don't perform atomic mallocs on the new transaction and we can't block without protecting against other processes trying to touch the journal while it is in transition.  */
static transaction_t* jbd2_get_transaction(journal_t *journal, transaction_t *transaction)
{
	transaction->t_journal = journal;
	transaction->t_state = T_RUNNING;
	transaction->t_start_time = ktime_get();
	transaction->t_tid = journal->j_transaction_sequence++;
	transaction->t_expires = jiffies + journal->j_commit_interval;
	spin_lock_init(&transaction->t_handle_lock);
	INIT_LIST_HEAD(&transaction->t_inode_list);
	INIT_LIST_HEAD(&transaction->t_private_list);
	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
	add_timer(&journal->j_commit_timer);
	J_ASSERT(journal->j_running_transaction == NULL);
	journal->j_running_transaction = transaction;
	transaction->t_max_wait = 0;
	transaction->t_start = jiffies;
	return transaction;
}