Lines Matching refs:jh
30 static inline void __buffer_unlink_first(struct journal_head *jh) in __buffer_unlink_first() argument
32 transaction_t *transaction = jh->b_cp_transaction; in __buffer_unlink_first()
34 jh->b_cpnext->b_cpprev = jh->b_cpprev; in __buffer_unlink_first()
35 jh->b_cpprev->b_cpnext = jh->b_cpnext; in __buffer_unlink_first()
36 if (transaction->t_checkpoint_list == jh) { in __buffer_unlink_first()
37 transaction->t_checkpoint_list = jh->b_cpnext; in __buffer_unlink_first()
38 if (transaction->t_checkpoint_list == jh) in __buffer_unlink_first()
48 static inline void __buffer_unlink(struct journal_head *jh) in __buffer_unlink() argument
50 transaction_t *transaction = jh->b_cp_transaction; in __buffer_unlink()
52 __buffer_unlink_first(jh); in __buffer_unlink()
53 if (transaction->t_checkpoint_io_list == jh) { in __buffer_unlink()
54 transaction->t_checkpoint_io_list = jh->b_cpnext; in __buffer_unlink()
55 if (transaction->t_checkpoint_io_list == jh) in __buffer_unlink()
65 static inline void __buffer_relink_io(struct journal_head *jh) in __buffer_relink_io() argument
67 transaction_t *transaction = jh->b_cp_transaction; in __buffer_relink_io()
69 __buffer_unlink_first(jh); in __buffer_relink_io()
72 jh->b_cpnext = jh->b_cpprev = jh; in __buffer_relink_io()
74 jh->b_cpnext = transaction->t_checkpoint_io_list; in __buffer_relink_io()
75 jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev; in __buffer_relink_io()
76 jh->b_cpprev->b_cpnext = jh; in __buffer_relink_io()
77 jh->b_cpnext->b_cpprev = jh; in __buffer_relink_io()
79 transaction->t_checkpoint_io_list = jh; in __buffer_relink_io()
87 static inline bool __cp_buffer_busy(struct journal_head *jh) in __cp_buffer_busy() argument
89 struct buffer_head *bh = jh2bh(jh); in __cp_buffer_busy()
91 return (jh->b_transaction || buffer_locked(bh) || buffer_dirty(bh)); in __cp_buffer_busy()
200 struct journal_head *jh; in jbd2_log_do_checkpoint() local
242 jh = transaction->t_checkpoint_list; in jbd2_log_do_checkpoint()
243 bh = jh2bh(jh); in jbd2_log_do_checkpoint()
254 if (jh->b_transaction != NULL) { in jbd2_log_do_checkpoint()
255 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()
354 if (__jbd2_journal_remove_checkpoint(jh)) in jbd2_log_do_checkpoint()
420 static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy) in journal_clean_one_cp_list() argument
423 struct journal_head *next_jh = jh; in journal_clean_one_cp_list()
425 if (!jh) in journal_clean_one_cp_list()
428 last_jh = jh->b_cpprev; in journal_clean_one_cp_list()
430 jh = next_jh; in journal_clean_one_cp_list()
431 next_jh = jh->b_cpnext; in journal_clean_one_cp_list()
433 if (!destroy && __cp_buffer_busy(jh)) in journal_clean_one_cp_list()
436 if (__jbd2_journal_remove_checkpoint(jh)) in journal_clean_one_cp_list()
446 } while (jh != last_jh); in journal_clean_one_cp_list()
461 static unsigned long journal_shrink_one_cp_list(struct journal_head *jh, in journal_shrink_one_cp_list() argument
466 struct journal_head *next_jh = jh; in journal_shrink_one_cp_list()
470 if (!jh || *nr_to_scan == 0) in journal_shrink_one_cp_list()
473 last_jh = jh->b_cpprev; in journal_shrink_one_cp_list()
475 jh = next_jh; in journal_shrink_one_cp_list()
476 next_jh = jh->b_cpnext; in journal_shrink_one_cp_list()
479 if (__cp_buffer_busy(jh)) in journal_shrink_one_cp_list()
483 ret = __jbd2_journal_remove_checkpoint(jh); in journal_shrink_one_cp_list()
491 } while (jh != last_jh && *nr_to_scan); in journal_shrink_one_cp_list()
674 int __jbd2_journal_remove_checkpoint(struct journal_head *jh) in __jbd2_journal_remove_checkpoint() argument
679 struct buffer_head *bh = jh2bh(jh); in __jbd2_journal_remove_checkpoint()
681 JBUFFER_TRACE(jh, "entry"); in __jbd2_journal_remove_checkpoint()
683 transaction = jh->b_cp_transaction; in __jbd2_journal_remove_checkpoint()
685 JBUFFER_TRACE(jh, "not on transaction"); in __jbd2_journal_remove_checkpoint()
690 JBUFFER_TRACE(jh, "removing from transaction"); in __jbd2_journal_remove_checkpoint()
702 __buffer_unlink(jh); in __jbd2_journal_remove_checkpoint()
703 jh->b_cp_transaction = NULL; in __jbd2_journal_remove_checkpoint()
705 jbd2_journal_put_journal_head(jh); in __jbd2_journal_remove_checkpoint()
747 void __jbd2_journal_insert_checkpoint(struct journal_head *jh, in __jbd2_journal_insert_checkpoint() argument
750 JBUFFER_TRACE(jh, "entry"); in __jbd2_journal_insert_checkpoint()
751 J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); in __jbd2_journal_insert_checkpoint()
752 J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); in __jbd2_journal_insert_checkpoint()
755 jbd2_journal_grab_journal_head(jh2bh(jh)); in __jbd2_journal_insert_checkpoint()
756 jh->b_cp_transaction = transaction; in __jbd2_journal_insert_checkpoint()
759 jh->b_cpnext = jh->b_cpprev = jh; in __jbd2_journal_insert_checkpoint()
761 jh->b_cpnext = transaction->t_checkpoint_list; in __jbd2_journal_insert_checkpoint()
762 jh->b_cpprev = transaction->t_checkpoint_list->b_cpprev; in __jbd2_journal_insert_checkpoint()
763 jh->b_cpprev->b_cpnext = jh; in __jbd2_journal_insert_checkpoint()
764 jh->b_cpnext->b_cpprev = jh; in __jbd2_journal_insert_checkpoint()
766 transaction->t_checkpoint_list = jh; in __jbd2_journal_insert_checkpoint()