Lines Matching refs:journal
85 void __jbd2_log_wait_for_space(journal_t *journal) in __jbd2_log_wait_for_space() argument
86 __acquires(&journal->j_state_lock) in __jbd2_log_wait_for_space()
87 __releases(&journal->j_state_lock) in __jbd2_log_wait_for_space()
92 nblocks = jbd2_space_needed(journal); in __jbd2_log_wait_for_space()
93 while (jbd2_log_space_left(journal) < nblocks) { in __jbd2_log_wait_for_space()
94 write_unlock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
95 mutex_lock_io(&journal->j_checkpoint_mutex); in __jbd2_log_wait_for_space()
108 write_lock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
109 if (journal->j_flags & JBD2_ABORT) { in __jbd2_log_wait_for_space()
110 mutex_unlock(&journal->j_checkpoint_mutex); in __jbd2_log_wait_for_space()
113 spin_lock(&journal->j_list_lock); in __jbd2_log_wait_for_space()
114 space_left = jbd2_log_space_left(journal); in __jbd2_log_wait_for_space()
116 int chkpt = journal->j_checkpoint_transactions != NULL; in __jbd2_log_wait_for_space()
119 if (journal->j_committing_transaction) in __jbd2_log_wait_for_space()
120 tid = journal->j_committing_transaction->t_tid; in __jbd2_log_wait_for_space()
121 spin_unlock(&journal->j_list_lock); in __jbd2_log_wait_for_space()
122 write_unlock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
124 jbd2_log_do_checkpoint(journal); in __jbd2_log_wait_for_space()
125 } else if (jbd2_cleanup_journal_tail(journal) == 0) { in __jbd2_log_wait_for_space()
134 mutex_unlock(&journal->j_checkpoint_mutex); in __jbd2_log_wait_for_space()
135 jbd2_log_wait_commit(journal, tid); in __jbd2_log_wait_for_space()
136 write_lock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
144 journal->j_devname); in __jbd2_log_wait_for_space()
146 jbd2_journal_abort(journal, -EIO); in __jbd2_log_wait_for_space()
148 write_lock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
150 spin_unlock(&journal->j_list_lock); in __jbd2_log_wait_for_space()
152 mutex_unlock(&journal->j_checkpoint_mutex); in __jbd2_log_wait_for_space()
157 __flush_batch(journal_t *journal, int *batch_count) in __flush_batch() argument
164 write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC); in __flush_batch()
168 struct buffer_head *bh = journal->j_chkpt_bhs[i]; in __flush_batch()
171 journal->j_chkpt_bhs[i] = NULL; in __flush_batch()
184 int jbd2_log_do_checkpoint(journal_t *journal) in jbd2_log_do_checkpoint() argument
199 result = jbd2_cleanup_journal_tail(journal); in jbd2_log_do_checkpoint()
200 trace_jbd2_checkpoint(journal, result); in jbd2_log_do_checkpoint()
209 spin_lock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
210 if (!journal->j_checkpoint_transactions) in jbd2_log_do_checkpoint()
212 transaction = journal->j_checkpoint_transactions; in jbd2_log_do_checkpoint()
222 if (journal->j_checkpoint_transactions != transaction || in jbd2_log_do_checkpoint()
236 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
237 if (unlikely(journal->j_flags & JBD2_UNMOUNT)) in jbd2_log_do_checkpoint()
246 journal->j_devname, (unsigned long long) bh->b_blocknr); in jbd2_log_do_checkpoint()
249 __flush_batch(journal, &batch_count); in jbd2_log_do_checkpoint()
250 jbd2_log_start_commit(journal, tid); in jbd2_log_do_checkpoint()
259 mutex_unlock(&journal->j_checkpoint_mutex); in jbd2_log_do_checkpoint()
260 jbd2_log_wait_commit(journal, tid); in jbd2_log_do_checkpoint()
261 mutex_lock_io(&journal->j_checkpoint_mutex); in jbd2_log_do_checkpoint()
262 spin_lock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
273 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
301 journal->j_chkpt_bhs[batch_count++] = bh; in jbd2_log_do_checkpoint()
307 need_resched() || spin_needbreak(&journal->j_list_lock) || in jbd2_log_do_checkpoint()
308 jh2bh(transaction->t_checkpoint_list) == journal->j_chkpt_bhs[0]) in jbd2_log_do_checkpoint()
314 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
317 __flush_batch(journal, &batch_count); in jbd2_log_do_checkpoint()
318 spin_lock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
323 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
324 result = jbd2_cleanup_journal_tail(journal); in jbd2_log_do_checkpoint()
347 int jbd2_cleanup_journal_tail(journal_t *journal) in jbd2_cleanup_journal_tail() argument
352 if (is_journal_aborted(journal)) in jbd2_cleanup_journal_tail()
355 if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr)) in jbd2_cleanup_journal_tail()
367 if (journal->j_flags & JBD2_BARRIER) in jbd2_cleanup_journal_tail()
368 blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); in jbd2_cleanup_journal_tail()
370 return __jbd2_update_log_tail(journal, first_tid, blocknr); in jbd2_cleanup_journal_tail()
427 void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy) in __jbd2_journal_clean_checkpoint_list() argument
432 transaction = journal->j_checkpoint_transactions; in __jbd2_journal_clean_checkpoint_list()
475 void jbd2_journal_destroy_checkpoint(journal_t *journal) in jbd2_journal_destroy_checkpoint() argument
482 spin_lock(&journal->j_list_lock); in jbd2_journal_destroy_checkpoint()
483 if (!journal->j_checkpoint_transactions) { in jbd2_journal_destroy_checkpoint()
484 spin_unlock(&journal->j_list_lock); in jbd2_journal_destroy_checkpoint()
487 __jbd2_journal_clean_checkpoint_list(journal, true); in jbd2_journal_destroy_checkpoint()
488 spin_unlock(&journal->j_list_lock); in jbd2_journal_destroy_checkpoint()
515 journal_t *journal; in __jbd2_journal_remove_checkpoint() local
524 journal = transaction->t_journal; in __jbd2_journal_remove_checkpoint()
553 trace_jbd2_checkpoint_stats(journal->j_fs_dev->bd_dev, in __jbd2_journal_remove_checkpoint()
556 __jbd2_journal_drop_transaction(journal, transaction); in __jbd2_journal_remove_checkpoint()
603 void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transaction) in __jbd2_journal_drop_transaction() argument
605 assert_spin_locked(&journal->j_list_lock); in __jbd2_journal_drop_transaction()
609 if (journal->j_checkpoint_transactions == transaction) in __jbd2_journal_drop_transaction()
610 journal->j_checkpoint_transactions = in __jbd2_journal_drop_transaction()
612 if (journal->j_checkpoint_transactions == transaction) in __jbd2_journal_drop_transaction()
613 journal->j_checkpoint_transactions = NULL; in __jbd2_journal_drop_transaction()
623 J_ASSERT(journal->j_committing_transaction != transaction); in __jbd2_journal_drop_transaction()
624 J_ASSERT(journal->j_running_transaction != transaction); in __jbd2_journal_drop_transaction()
626 trace_jbd2_drop_transaction(journal, transaction); in __jbd2_journal_drop_transaction()