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