Lines Matching refs:jh
33 static inline void __buffer_unlink_first(struct journal_head *jh) in __buffer_unlink_first() argument
35 transaction_t *transaction = jh->b_cp_transaction; in __buffer_unlink_first()
37 jh->b_cpnext->b_cpprev = jh->b_cpprev; in __buffer_unlink_first()
38 jh->b_cpprev->b_cpnext = jh->b_cpnext; in __buffer_unlink_first()
39 if (transaction->t_checkpoint_list == jh) { in __buffer_unlink_first()
40 transaction->t_checkpoint_list = jh->b_cpnext; in __buffer_unlink_first()
41 if (transaction->t_checkpoint_list == jh) in __buffer_unlink_first()
51 static inline void __buffer_unlink(struct journal_head *jh) in __buffer_unlink() argument
53 transaction_t *transaction = jh->b_cp_transaction; in __buffer_unlink()
55 __buffer_unlink_first(jh); in __buffer_unlink()
56 if (transaction->t_checkpoint_io_list == jh) { in __buffer_unlink()
57 transaction->t_checkpoint_io_list = jh->b_cpnext; in __buffer_unlink()
58 if (transaction->t_checkpoint_io_list == jh) in __buffer_unlink()
68 static inline void __buffer_relink_io(struct journal_head *jh) in __buffer_relink_io() argument
70 transaction_t *transaction = jh->b_cp_transaction; in __buffer_relink_io()
72 __buffer_unlink_first(jh); in __buffer_relink_io()
75 jh->b_cpnext = jh->b_cpprev = jh; in __buffer_relink_io()
77 jh->b_cpnext = transaction->t_checkpoint_io_list; in __buffer_relink_io()
78 jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev; in __buffer_relink_io()
79 jh->b_cpprev->b_cpnext = jh; in __buffer_relink_io()
80 jh->b_cpnext->b_cpprev = jh; in __buffer_relink_io()
82 transaction->t_checkpoint_io_list = jh; in __buffer_relink_io()
92 static int __try_to_free_cp_buf(struct journal_head *jh) in __try_to_free_cp_buf() argument
95 struct buffer_head *bh = jh2bh(jh); in __try_to_free_cp_buf()
97 if (jh->b_transaction == NULL && !buffer_locked(bh) && in __try_to_free_cp_buf()
99 JBUFFER_TRACE(jh, "remove from checkpoint list"); in __try_to_free_cp_buf()
100 ret = __jbd2_journal_remove_checkpoint(jh) + 1; in __try_to_free_cp_buf()
210 struct journal_head *jh; in jbd2_log_do_checkpoint() local
253 jh = transaction->t_checkpoint_list; in jbd2_log_do_checkpoint()
254 bh = jh2bh(jh); in jbd2_log_do_checkpoint()
265 if (jh->b_transaction != NULL) { in jbd2_log_do_checkpoint()
266 transaction_t *t = jh->b_transaction; in jbd2_log_do_checkpoint()
290 if (__jbd2_journal_remove_checkpoint(jh)) in jbd2_log_do_checkpoint()
307 __buffer_relink_io(jh); in jbd2_log_do_checkpoint()
336 jh = transaction->t_checkpoint_io_list; in jbd2_log_do_checkpoint()
337 bh = jh2bh(jh); in jbd2_log_do_checkpoint()
356 if (__jbd2_journal_remove_checkpoint(jh)) in jbd2_log_do_checkpoint()
425 static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy) in journal_clean_one_cp_list() argument
428 struct journal_head *next_jh = jh; in journal_clean_one_cp_list()
431 if (!jh) in journal_clean_one_cp_list()
434 last_jh = jh->b_cpprev; in journal_clean_one_cp_list()
436 jh = next_jh; in journal_clean_one_cp_list()
437 next_jh = jh->b_cpnext; in journal_clean_one_cp_list()
439 ret = __try_to_free_cp_buf(jh); in journal_clean_one_cp_list()
441 ret = __jbd2_journal_remove_checkpoint(jh) + 1; in journal_clean_one_cp_list()
454 } while (jh != last_jh); in journal_clean_one_cp_list()
551 int __jbd2_journal_remove_checkpoint(struct journal_head *jh) in __jbd2_journal_remove_checkpoint() argument
558 JBUFFER_TRACE(jh, "entry"); in __jbd2_journal_remove_checkpoint()
560 if ((transaction = jh->b_cp_transaction) == NULL) { in __jbd2_journal_remove_checkpoint()
561 JBUFFER_TRACE(jh, "not on transaction"); in __jbd2_journal_remove_checkpoint()
566 JBUFFER_TRACE(jh, "removing from transaction"); in __jbd2_journal_remove_checkpoint()
567 __buffer_unlink(jh); in __jbd2_journal_remove_checkpoint()
568 jh->b_cp_transaction = NULL; in __jbd2_journal_remove_checkpoint()
569 jbd2_journal_put_journal_head(jh); in __jbd2_journal_remove_checkpoint()
611 void __jbd2_journal_insert_checkpoint(struct journal_head *jh, in __jbd2_journal_insert_checkpoint() argument
614 JBUFFER_TRACE(jh, "entry"); in __jbd2_journal_insert_checkpoint()
615 J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); in __jbd2_journal_insert_checkpoint()
616 J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); in __jbd2_journal_insert_checkpoint()
619 jbd2_journal_grab_journal_head(jh2bh(jh)); in __jbd2_journal_insert_checkpoint()
620 jh->b_cp_transaction = transaction; in __jbd2_journal_insert_checkpoint()
623 jh->b_cpnext = jh->b_cpprev = jh; in __jbd2_journal_insert_checkpoint()
625 jh->b_cpnext = transaction->t_checkpoint_list; in __jbd2_journal_insert_checkpoint()
626 jh->b_cpprev = transaction->t_checkpoint_list->b_cpprev; in __jbd2_journal_insert_checkpoint()
627 jh->b_cpprev->b_cpnext = jh; in __jbd2_journal_insert_checkpoint()
628 jh->b_cpnext->b_cpprev = jh; in __jbd2_journal_insert_checkpoint()
630 transaction->t_checkpoint_list = jh; in __jbd2_journal_insert_checkpoint()