/* Called with the journal locked. Called with j_list_lock held.  */
void __journal_insert_checkpoint(struct journal_head *jh, transaction_t *transaction)
/* Called with the journal locked. Called with j_list_lock held.  */
void __journal_insert_checkpoint(struct journal_head *jh, transaction_t *transaction)
{
	JBUFFER_TRACE(jh, "entry");
	J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh)));
	J_ASSERT_JH(jh, jh->b_cp_transaction == NULL);
	jh->b_cp_transaction = transaction;
	if (!transaction->t_checkpoint_list) {
		jh->b_cpnext = jh->b_cpprev = jh;
	} else {
		jh->b_cpnext = transaction->t_checkpoint_list;
		jh->b_cpprev = transaction->t_checkpoint_list->b_cpprev;
		jh->b_cpprev->b_cpnext = jh;
		jh->b_cpnext->b_cpprev = jh;
	}
	transaction->t_checkpoint_list = jh;
}