Lines Matching refs:journal
50 get_transaction(journal_t *journal, transaction_t *transaction) in get_transaction() argument
52 transaction->t_journal = journal; in get_transaction()
55 transaction->t_tid = journal->j_transaction_sequence++; in get_transaction()
56 transaction->t_expires = jiffies + journal->j_commit_interval; in get_transaction()
60 journal->j_commit_timer.expires = in get_transaction()
62 add_timer(&journal->j_commit_timer); in get_transaction()
64 J_ASSERT(journal->j_running_transaction == NULL); in get_transaction()
65 journal->j_running_transaction = transaction; in get_transaction()
85 static int start_this_handle(journal_t *journal, handle_t *handle) in start_this_handle() argument
93 if (nblocks > journal->j_max_transaction_buffers) { in start_this_handle()
96 journal->j_max_transaction_buffers); in start_this_handle()
102 if (!journal->j_running_transaction) { in start_this_handle()
118 spin_lock(&journal->j_state_lock); in start_this_handle()
120 if (is_journal_aborted(journal) || in start_this_handle()
121 (journal->j_errno != 0 && !(journal->j_flags & JFS_ACK_ERR))) { in start_this_handle()
122 spin_unlock(&journal->j_state_lock); in start_this_handle()
128 if (journal->j_barrier_count) { in start_this_handle()
129 spin_unlock(&journal->j_state_lock); in start_this_handle()
130 wait_event(journal->j_wait_transaction_locked, in start_this_handle()
131 journal->j_barrier_count == 0); in start_this_handle()
135 if (!journal->j_running_transaction) { in start_this_handle()
137 spin_unlock(&journal->j_state_lock); in start_this_handle()
140 get_transaction(journal, new_transaction); in start_this_handle()
144 transaction = journal->j_running_transaction; in start_this_handle()
153 prepare_to_wait(&journal->j_wait_transaction_locked, in start_this_handle()
155 spin_unlock(&journal->j_state_lock); in start_this_handle()
157 finish_wait(&journal->j_wait_transaction_locked, &wait); in start_this_handle()
169 if (needed > journal->j_max_transaction_buffers) { in start_this_handle()
179 prepare_to_wait(&journal->j_wait_transaction_locked, &wait, in start_this_handle()
181 __log_start_commit(journal, transaction->t_tid); in start_this_handle()
182 spin_unlock(&journal->j_state_lock); in start_this_handle()
184 finish_wait(&journal->j_wait_transaction_locked, &wait); in start_this_handle()
213 if (__log_space_left(journal) < jbd_space_needed(journal)) { in start_this_handle()
216 __log_wait_for_space(journal); in start_this_handle()
229 __log_space_left(journal)); in start_this_handle()
231 spin_unlock(&journal->j_state_lock); in start_this_handle()
272 handle_t *journal_start(journal_t *journal, int nblocks) in journal_start() argument
277 if (!journal) in journal_start()
281 J_ASSERT(handle->h_transaction->t_journal == journal); in journal_start()
292 err = start_this_handle(journal, handle); in journal_start()
324 journal_t *journal = transaction->t_journal; in journal_extend() local
334 spin_lock(&journal->j_state_lock); in journal_extend()
346 if (wanted > journal->j_max_transaction_buffers) { in journal_extend()
352 if (wanted > __log_space_left(journal)) { in journal_extend()
366 spin_unlock(&journal->j_state_lock); in journal_extend()
390 journal_t *journal = transaction->t_journal; in journal_restart() local
405 spin_lock(&journal->j_state_lock); in journal_restart()
411 wake_up(&journal->j_wait_updates); in journal_restart()
415 __log_start_commit(journal, transaction->t_tid); in journal_restart()
416 spin_unlock(&journal->j_state_lock); in journal_restart()
420 ret = start_this_handle(journal, handle); in journal_restart()
439 void journal_lock_updates(journal_t *journal) in journal_lock_updates() argument
445 wait_event(journal->j_wait_transaction_locked, in journal_lock_updates()
446 journal->j_barrier_count == 0); in journal_lock_updates()
448 spin_lock(&journal->j_state_lock); in journal_lock_updates()
453 if (journal->j_barrier_count > 0) { in journal_lock_updates()
454 spin_unlock(&journal->j_state_lock); in journal_lock_updates()
457 ++journal->j_barrier_count; in journal_lock_updates()
461 transaction_t *transaction = journal->j_running_transaction; in journal_lock_updates()
471 prepare_to_wait(&journal->j_wait_updates, &wait, in journal_lock_updates()
474 spin_unlock(&journal->j_state_lock); in journal_lock_updates()
476 finish_wait(&journal->j_wait_updates, &wait); in journal_lock_updates()
477 spin_lock(&journal->j_state_lock); in journal_lock_updates()
479 spin_unlock(&journal->j_state_lock); in journal_lock_updates()
488 void journal_unlock_updates (journal_t *journal) in journal_unlock_updates() argument
490 J_ASSERT(journal->j_barrier_count != 0); in journal_unlock_updates()
492 spin_lock(&journal->j_state_lock); in journal_unlock_updates()
493 --journal->j_barrier_count; in journal_unlock_updates()
494 spin_unlock(&journal->j_state_lock); in journal_unlock_updates()
495 wake_up(&journal->j_wait_transaction_locked); in journal_unlock_updates()
525 journal_t *journal; in do_get_write_access() local
534 journal = transaction->t_journal; in do_get_write_access()
569 journal->j_committing_transaction); in do_get_write_access()
625 journal->j_committing_transaction); in do_get_write_access()
706 spin_lock(&journal->j_list_lock); in do_get_write_access()
708 spin_unlock(&journal->j_list_lock); in do_get_write_access()
788 journal_t *journal = transaction->t_journal; in journal_get_create_access() local
807 spin_lock(&journal->j_list_lock); in journal_get_create_access()
810 (jh->b_transaction == journal->j_committing_transaction && in journal_get_create_access()
832 } else if (jh->b_transaction == journal->j_committing_transaction) { in journal_get_create_access()
839 spin_unlock(&journal->j_list_lock); in journal_get_create_access()
950 journal_t *journal = handle->h_transaction->t_journal; in journal_dirty_data() local
989 spin_lock(&journal->j_list_lock); in journal_dirty_data()
1002 journal->j_committing_transaction); in journal_dirty_data()
1052 spin_unlock(&journal->j_list_lock); in journal_dirty_data()
1057 spin_lock(&journal->j_list_lock); in journal_dirty_data()
1108 spin_unlock(&journal->j_list_lock); in journal_dirty_data()
1141 journal_t *journal = transaction->t_journal; in journal_dirty_metadata() local
1172 journal->j_running_transaction); in journal_dirty_metadata()
1187 journal->j_committing_transaction); in journal_dirty_metadata()
1198 spin_lock(&journal->j_list_lock); in journal_dirty_metadata()
1200 spin_unlock(&journal->j_list_lock); in journal_dirty_metadata()
1239 journal_t *journal = transaction->t_journal; in journal_forget() local
1248 spin_lock(&journal->j_list_lock); in journal_forget()
1307 spin_unlock(&journal->j_list_lock); in journal_forget()
1315 journal->j_committing_transaction)); in journal_forget()
1336 spin_unlock(&journal->j_list_lock); in journal_forget()
1366 journal_t *journal = transaction->t_journal; in journal_stop() local
1413 if (handle->h_sync && journal->j_last_sync_writer != pid) { in journal_stop()
1416 journal->j_last_sync_writer = pid; in journal_stop()
1418 spin_lock(&journal->j_state_lock); in journal_stop()
1419 commit_time = journal->j_average_commit_time; in journal_stop()
1420 spin_unlock(&journal->j_state_lock); in journal_stop()
1439 spin_lock(&journal->j_state_lock); in journal_stop()
1444 wake_up(&journal->j_wait_updates); in journal_stop()
1445 if (journal->j_barrier_count) in journal_stop()
1446 wake_up(&journal->j_wait_transaction_locked); in journal_stop()
1457 journal->j_max_transaction_buffers || in journal_stop()
1468 __log_start_commit(journal, transaction->t_tid); in journal_stop()
1469 spin_unlock(&journal->j_state_lock); in journal_stop()
1476 err = log_wait_commit(journal, tid); in journal_stop()
1479 spin_unlock(&journal->j_state_lock); in journal_stop()
1496 int journal_force_commit(journal_t *journal) in journal_force_commit() argument
1501 handle = journal_start(journal, 1); in journal_force_commit()
1640 void journal_unfile_buffer(journal_t *journal, struct journal_head *jh) in journal_unfile_buffer() argument
1647 spin_lock(&journal->j_list_lock); in journal_unfile_buffer()
1649 spin_unlock(&journal->j_list_lock); in journal_unfile_buffer()
1660 __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) in __journal_try_to_free_buffer() argument
1672 spin_lock(&journal->j_list_lock); in __journal_try_to_free_buffer()
1686 spin_unlock(&journal->j_list_lock); in __journal_try_to_free_buffer()
1729 int journal_try_to_free_buffers(journal_t *journal, in journal_try_to_free_buffers() argument
1753 __journal_try_to_free_buffer(journal, bh); in journal_try_to_free_buffers()
1848 static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, in journal_unmap_buffer() argument
1867 spin_lock(&journal->j_state_lock); in journal_unmap_buffer()
1869 spin_lock(&journal->j_list_lock); in journal_unmap_buffer()
1918 if (journal->j_running_transaction) { in journal_unmap_buffer()
1924 journal->j_running_transaction); in journal_unmap_buffer()
1931 if (journal->j_committing_transaction) { in journal_unmap_buffer()
1934 journal->j_committing_transaction); in journal_unmap_buffer()
1943 } else if (transaction == journal->j_committing_transaction) { in journal_unmap_buffer()
1960 tid_t tid = journal->j_committing_transaction->t_tid; in journal_unmap_buffer()
1963 spin_unlock(&journal->j_list_lock); in journal_unmap_buffer()
1965 spin_unlock(&journal->j_state_lock); in journal_unmap_buffer()
1967 log_wait_commit(journal, tid); in journal_unmap_buffer()
1978 if (journal->j_running_transaction && buffer_jbddirty(bh)) in journal_unmap_buffer()
1979 jh->b_next_transaction = journal->j_running_transaction; in journal_unmap_buffer()
1981 spin_unlock(&journal->j_list_lock); in journal_unmap_buffer()
1983 spin_unlock(&journal->j_state_lock); in journal_unmap_buffer()
1992 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); in journal_unmap_buffer()
2008 spin_unlock(&journal->j_list_lock); in journal_unmap_buffer()
2010 spin_unlock(&journal->j_state_lock); in journal_unmap_buffer()
2029 void journal_invalidatepage(journal_t *journal, in journal_invalidatepage() argument
2054 may_free &= journal_unmap_buffer(journal, bh, in journal_invalidatepage()
2219 void journal_refile_buffer(journal_t *journal, struct journal_head *jh) in journal_refile_buffer() argument
2226 spin_lock(&journal->j_list_lock); in journal_refile_buffer()
2229 spin_unlock(&journal->j_list_lock); in journal_refile_buffer()