Lines Matching refs:journal
118 void __jbd2_log_wait_for_space(journal_t *journal) in __jbd2_log_wait_for_space() argument
123 nblocks = jbd_space_needed(journal); in __jbd2_log_wait_for_space()
124 while (__jbd2_log_space_left(journal) < nblocks) { in __jbd2_log_wait_for_space()
125 if (journal->j_flags & JBD2_ABORT) in __jbd2_log_wait_for_space()
127 write_unlock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
128 mutex_lock(&journal->j_checkpoint_mutex); in __jbd2_log_wait_for_space()
141 write_lock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
142 spin_lock(&journal->j_list_lock); in __jbd2_log_wait_for_space()
143 nblocks = jbd_space_needed(journal); in __jbd2_log_wait_for_space()
144 space_left = __jbd2_log_space_left(journal); in __jbd2_log_wait_for_space()
146 int chkpt = journal->j_checkpoint_transactions != NULL; in __jbd2_log_wait_for_space()
149 if (journal->j_committing_transaction) in __jbd2_log_wait_for_space()
150 tid = journal->j_committing_transaction->t_tid; in __jbd2_log_wait_for_space()
151 spin_unlock(&journal->j_list_lock); in __jbd2_log_wait_for_space()
152 write_unlock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
154 jbd2_log_do_checkpoint(journal); in __jbd2_log_wait_for_space()
155 } else if (jbd2_cleanup_journal_tail(journal) == 0) { in __jbd2_log_wait_for_space()
159 jbd2_log_wait_commit(journal, tid); in __jbd2_log_wait_for_space()
166 journal->j_devname); in __jbd2_log_wait_for_space()
168 jbd2_journal_abort(journal, 0); in __jbd2_log_wait_for_space()
170 write_lock(&journal->j_state_lock); in __jbd2_log_wait_for_space()
172 spin_unlock(&journal->j_list_lock); in __jbd2_log_wait_for_space()
174 mutex_unlock(&journal->j_checkpoint_mutex); in __jbd2_log_wait_for_space()
189 static int __wait_cp_io(journal_t *journal, transaction_t *transaction) in __wait_cp_io() argument
200 if (journal->j_checkpoint_transactions != transaction || in __wait_cp_io()
208 spin_unlock(&journal->j_list_lock); in __wait_cp_io()
213 spin_lock(&journal->j_list_lock); in __wait_cp_io()
231 __flush_batch(journal_t *journal, int *batch_count) in __flush_batch() argument
238 write_dirty_buffer(journal->j_chkpt_bhs[i], WRITE_SYNC); in __flush_batch()
242 struct buffer_head *bh = journal->j_chkpt_bhs[i]; in __flush_batch()
258 static int __process_buffer(journal_t *journal, struct journal_head *jh, in __process_buffer() argument
266 spin_unlock(&journal->j_list_lock); in __process_buffer()
277 spin_unlock(&journal->j_list_lock); in __process_buffer()
278 if (unlikely(journal->j_flags & JBD2_UNMOUNT)) in __process_buffer()
286 journal->j_devname, in __process_buffer()
288 jbd2_log_start_commit(journal, tid); in __process_buffer()
289 jbd2_log_wait_commit(journal, tid); in __process_buffer()
298 spin_unlock(&journal->j_list_lock); in __process_buffer()
311 journal->j_chkpt_bhs[*batch_count] = bh; in __process_buffer()
316 spin_unlock(&journal->j_list_lock); in __process_buffer()
317 __flush_batch(journal, batch_count); in __process_buffer()
332 int jbd2_log_do_checkpoint(journal_t *journal) in jbd2_log_do_checkpoint() argument
345 result = jbd2_cleanup_journal_tail(journal); in jbd2_log_do_checkpoint()
346 trace_jbd2_checkpoint(journal, result); in jbd2_log_do_checkpoint()
356 spin_lock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
357 if (!journal->j_checkpoint_transactions) in jbd2_log_do_checkpoint()
359 transaction = journal->j_checkpoint_transactions; in jbd2_log_do_checkpoint()
369 if (journal->j_checkpoint_transactions == transaction && in jbd2_log_do_checkpoint()
377 retry = __process_buffer(journal, jh, &batch_count, in jbd2_log_do_checkpoint()
382 spin_needbreak(&journal->j_list_lock))) { in jbd2_log_do_checkpoint()
383 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
391 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
394 __flush_batch(journal, &batch_count); in jbd2_log_do_checkpoint()
398 spin_lock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
405 err = __wait_cp_io(journal, transaction); in jbd2_log_do_checkpoint()
410 spin_unlock(&journal->j_list_lock); in jbd2_log_do_checkpoint()
412 jbd2_journal_abort(journal, result); in jbd2_log_do_checkpoint()
414 result = jbd2_cleanup_journal_tail(journal); in jbd2_log_do_checkpoint()
437 int jbd2_cleanup_journal_tail(journal_t *journal) in jbd2_cleanup_journal_tail() argument
442 if (is_journal_aborted(journal)) in jbd2_cleanup_journal_tail()
445 if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr)) in jbd2_cleanup_journal_tail()
457 if (journal->j_flags & JBD2_BARRIER) in jbd2_cleanup_journal_tail()
458 blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); in jbd2_cleanup_journal_tail()
460 __jbd2_update_log_tail(journal, first_tid, blocknr); in jbd2_cleanup_journal_tail()
523 int __jbd2_journal_clean_checkpoint_list(journal_t *journal) in __jbd2_journal_clean_checkpoint_list() argument
529 transaction = journal->j_checkpoint_transactions; in __jbd2_journal_clean_checkpoint_list()
585 journal_t *journal; in __jbd2_journal_remove_checkpoint() local
594 journal = transaction->t_journal; in __jbd2_journal_remove_checkpoint()
623 trace_jbd2_checkpoint_stats(journal->j_fs_dev->bd_dev, in __jbd2_journal_remove_checkpoint()
626 __jbd2_journal_drop_transaction(journal, transaction); in __jbd2_journal_remove_checkpoint()
631 wake_up(&journal->j_wait_logspace); in __jbd2_journal_remove_checkpoint()
677 void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transaction) in __jbd2_journal_drop_transaction() argument
679 assert_spin_locked(&journal->j_list_lock); in __jbd2_journal_drop_transaction()
683 if (journal->j_checkpoint_transactions == transaction) in __jbd2_journal_drop_transaction()
684 journal->j_checkpoint_transactions = in __jbd2_journal_drop_transaction()
686 if (journal->j_checkpoint_transactions == transaction) in __jbd2_journal_drop_transaction()
687 journal->j_checkpoint_transactions = NULL; in __jbd2_journal_drop_transaction()
699 J_ASSERT(journal->j_committing_transaction != transaction); in __jbd2_journal_drop_transaction()
700 J_ASSERT(journal->j_running_transaction != transaction); in __jbd2_journal_drop_transaction()
702 trace_jbd2_drop_transaction(journal, transaction); in __jbd2_journal_drop_transaction()