Lines Matching refs:transaction
58 void jbd2_journal_free_transaction(transaction_t *transaction) in jbd2_journal_free_transaction() argument
60 if (unlikely(ZERO_OR_NULL_PTR(transaction))) in jbd2_journal_free_transaction()
62 kmem_cache_free(transaction_cache, transaction); in jbd2_journal_free_transaction()
103 transaction_t *transaction) in jbd2_get_transaction() argument
105 transaction->t_journal = journal; in jbd2_get_transaction()
106 transaction->t_state = T_RUNNING; in jbd2_get_transaction()
107 transaction->t_start_time = ktime_get(); in jbd2_get_transaction()
108 transaction->t_tid = journal->j_transaction_sequence++; in jbd2_get_transaction()
109 transaction->t_expires = jiffies + journal->j_commit_interval; in jbd2_get_transaction()
110 spin_lock_init(&transaction->t_handle_lock); in jbd2_get_transaction()
111 atomic_set(&transaction->t_updates, 0); in jbd2_get_transaction()
112 atomic_set(&transaction->t_outstanding_credits, in jbd2_get_transaction()
115 atomic_set(&transaction->t_outstanding_revokes, 0); in jbd2_get_transaction()
116 atomic_set(&transaction->t_handle_count, 0); in jbd2_get_transaction()
117 INIT_LIST_HEAD(&transaction->t_inode_list); in jbd2_get_transaction()
118 INIT_LIST_HEAD(&transaction->t_private_list); in jbd2_get_transaction()
121 journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires); in jbd2_get_transaction()
125 journal->j_running_transaction = transaction; in jbd2_get_transaction()
126 transaction->t_max_wait = 0; in jbd2_get_transaction()
127 transaction->t_start = jiffies; in jbd2_get_transaction()
128 transaction->t_requested = 0; in jbd2_get_transaction()
149 static inline void update_t_max_wait(transaction_t *transaction, in update_t_max_wait() argument
154 time_after(transaction->t_start, ts)) { in update_t_max_wait()
155 ts = jbd2_time_diff(ts, transaction->t_start); in update_t_max_wait()
156 spin_lock(&transaction->t_handle_lock); in update_t_max_wait()
157 if (ts > transaction->t_max_wait) in update_t_max_wait()
158 transaction->t_max_wait = ts; in update_t_max_wait()
159 spin_unlock(&transaction->t_handle_lock); in update_t_max_wait()
328 transaction_t *transaction, *new_transaction = NULL; in start_this_handle() local
412 transaction = journal->j_running_transaction; in start_this_handle()
426 if (transaction->t_state == T_SWITCH) { in start_this_handle()
437 update_t_max_wait(transaction, ts); in start_this_handle()
438 handle->h_transaction = transaction; in start_this_handle()
442 atomic_inc(&transaction->t_updates); in start_this_handle()
443 atomic_inc(&transaction->t_handle_count); in start_this_handle()
446 atomic_read(&transaction->t_outstanding_credits), in start_this_handle()
650 transaction_t *transaction = handle->h_transaction; in jbd2_journal_extend() local
657 journal = transaction->t_journal; in jbd2_journal_extend()
664 if (transaction->t_state != T_RUNNING) { in jbd2_journal_extend()
676 spin_lock(&transaction->t_handle_lock); in jbd2_journal_extend()
678 &transaction->t_outstanding_credits); in jbd2_journal_extend()
683 atomic_sub(nblocks, &transaction->t_outstanding_credits); in jbd2_journal_extend()
688 transaction->t_tid, in jbd2_journal_extend()
701 spin_unlock(&transaction->t_handle_lock); in jbd2_journal_extend()
709 transaction_t *transaction = handle->h_transaction; in stop_this_handle() local
710 journal_t *journal = transaction->t_journal; in stop_this_handle()
714 J_ASSERT(atomic_read(&transaction->t_updates) > 0); in stop_this_handle()
730 &transaction->t_outstanding_revokes); in stop_this_handle()
737 &transaction->t_outstanding_credits); in stop_this_handle()
740 transaction); in stop_this_handle()
741 if (atomic_dec_and_test(&transaction->t_updates)) in stop_this_handle()
772 transaction_t *transaction = handle->h_transaction; in jbd2__journal_restart() local
782 journal = transaction->t_journal; in jbd2__journal_restart()
783 tid = transaction->t_tid; in jbd2__journal_restart()
851 transaction_t *transaction = journal->j_running_transaction; in jbd2_journal_lock_updates() local
853 if (!transaction) in jbd2_journal_lock_updates()
856 spin_lock(&transaction->t_handle_lock); in jbd2_journal_lock_updates()
859 if (!atomic_read(&transaction->t_updates)) { in jbd2_journal_lock_updates()
860 spin_unlock(&transaction->t_handle_lock); in jbd2_journal_lock_updates()
864 spin_unlock(&transaction->t_handle_lock); in jbd2_journal_lock_updates()
948 transaction_t *transaction = handle->h_transaction; in do_get_write_access() local
954 journal = transaction->t_journal; in do_get_write_access()
994 jh->b_transaction == transaction || in do_get_write_access()
999 transaction); in do_get_write_access()
1025 if (jh->b_transaction == transaction || in do_get_write_access()
1026 jh->b_next_transaction == transaction) in do_get_write_access()
1051 __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); in do_get_write_access()
1117 jh->b_next_transaction = transaction; in do_get_write_access()
1243 transaction_t *transaction = handle->h_transaction; in jbd2_journal_get_create_access() local
1252 journal = transaction->t_journal; in jbd2_journal_get_create_access()
1264 J_ASSERT_JH(jh, (jh->b_transaction == transaction || in jbd2_journal_get_create_access()
1287 __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); in jbd2_journal_get_create_access()
1295 jh->b_next_transaction = transaction; in jbd2_journal_get_create_access()
1458 transaction_t *transaction = handle->h_transaction; in jbd2_journal_dirty_metadata() local
1480 if (data_race(jh->b_transaction != transaction && in jbd2_journal_dirty_metadata()
1481 jh->b_next_transaction != transaction)) { in jbd2_journal_dirty_metadata()
1483 J_ASSERT_JH(jh, jh->b_transaction == transaction || in jbd2_journal_dirty_metadata()
1484 jh->b_next_transaction == transaction); in jbd2_journal_dirty_metadata()
1489 if (data_race(jh->b_transaction == transaction && in jbd2_journal_dirty_metadata()
1492 if (jh->b_transaction == transaction && in jbd2_journal_dirty_metadata()
1499 J_ASSERT_JH(jh, jh->b_transaction != transaction || in jbd2_journal_dirty_metadata()
1506 journal = transaction->t_journal; in jbd2_journal_dirty_metadata()
1542 if (jh->b_transaction == transaction && jh->b_jlist == BJ_Metadata) { in jbd2_journal_dirty_metadata()
1569 if (jh->b_transaction != transaction) { in jbd2_journal_dirty_metadata()
1573 (jh->b_next_transaction != transaction))) { in jbd2_journal_dirty_metadata()
1581 transaction, transaction->t_tid, in jbd2_journal_dirty_metadata()
1602 __jbd2_journal_file_buffer(jh, transaction, BJ_Metadata); in jbd2_journal_dirty_metadata()
1630 transaction_t *transaction = handle->h_transaction; in jbd2_journal_forget() local
1639 journal = transaction->t_journal; in jbd2_journal_forget()
1668 if (jh->b_transaction == transaction) { in jbd2_journal_forget()
1701 __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); in jbd2_journal_forget()
1724 jh->b_next_transaction = transaction; in jbd2_journal_forget()
1727 J_ASSERT(jh->b_next_transaction == transaction); in jbd2_journal_forget()
1766 __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); in jbd2_journal_forget()
1798 transaction_t *transaction = handle->h_transaction; in jbd2_journal_stop() local
1811 if (!transaction) { in jbd2_journal_stop()
1819 journal = transaction->t_journal; in jbd2_journal_stop()
1820 tid = transaction->t_tid; in jbd2_journal_stop()
1874 transaction->t_start_time)); in jbd2_journal_stop()
1890 transaction->t_synchronous_commit = 1; in jbd2_journal_stop()
1898 time_after_eq(jiffies, transaction->t_expires)) { in jbd2_journal_stop()
2000 transaction_t *transaction; in __jbd2_journal_temp_unlink_buffer() local
2004 transaction = jh->b_transaction; in __jbd2_journal_temp_unlink_buffer()
2005 if (transaction) in __jbd2_journal_temp_unlink_buffer()
2006 assert_spin_locked(&transaction->t_journal->j_list_lock); in __jbd2_journal_temp_unlink_buffer()
2010 J_ASSERT_JH(jh, transaction != NULL); in __jbd2_journal_temp_unlink_buffer()
2016 transaction->t_nr_buffers--; in __jbd2_journal_temp_unlink_buffer()
2017 J_ASSERT_JH(jh, transaction->t_nr_buffers >= 0); in __jbd2_journal_temp_unlink_buffer()
2018 list = &transaction->t_buffers; in __jbd2_journal_temp_unlink_buffer()
2021 list = &transaction->t_forget; in __jbd2_journal_temp_unlink_buffer()
2024 list = &transaction->t_shadow_list; in __jbd2_journal_temp_unlink_buffer()
2027 list = &transaction->t_reserved_list; in __jbd2_journal_temp_unlink_buffer()
2033 if (transaction && is_journal_aborted(transaction->t_journal)) in __jbd2_journal_temp_unlink_buffer()
2179 static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction) in __dispose_buffer() argument
2193 __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); in __dispose_buffer()
2253 transaction_t *transaction; in journal_unmap_buffer() local
2297 transaction = jh->b_transaction; in journal_unmap_buffer()
2298 if (transaction == NULL) { in journal_unmap_buffer()
2344 } else if (transaction == journal->j_committing_transaction) { in journal_unmap_buffer()
2381 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); in journal_unmap_buffer()
2383 may_free = __dispose_buffer(jh, transaction); in journal_unmap_buffer()
2480 transaction_t *transaction, int jlist) in __jbd2_journal_file_buffer() argument
2487 assert_spin_locked(&transaction->t_journal->j_list_lock); in __jbd2_journal_file_buffer()
2490 J_ASSERT_JH(jh, jh->b_transaction == transaction || in __jbd2_journal_file_buffer()
2516 jh->b_transaction = transaction; in __jbd2_journal_file_buffer()
2524 transaction->t_nr_buffers++; in __jbd2_journal_file_buffer()
2525 list = &transaction->t_buffers; in __jbd2_journal_file_buffer()
2528 list = &transaction->t_forget; in __jbd2_journal_file_buffer()
2531 list = &transaction->t_shadow_list; in __jbd2_journal_file_buffer()
2534 list = &transaction->t_reserved_list; in __jbd2_journal_file_buffer()
2546 transaction_t *transaction, int jlist) in jbd2_journal_file_buffer() argument
2549 spin_lock(&transaction->t_journal->j_list_lock); in jbd2_journal_file_buffer()
2550 __jbd2_journal_file_buffer(jh, transaction, jlist); in jbd2_journal_file_buffer()
2551 spin_unlock(&transaction->t_journal->j_list_lock); in jbd2_journal_file_buffer()
2643 transaction_t *transaction = handle->h_transaction; in jbd2_journal_file_inode() local
2648 journal = transaction->t_journal; in jbd2_journal_file_inode()
2651 transaction->t_tid); in jbd2_journal_file_inode()
2665 if (jinode->i_transaction == transaction || in jbd2_journal_file_inode()
2666 jinode->i_next_transaction == transaction) in jbd2_journal_file_inode()
2674 if (!transaction->t_need_data_flush) in jbd2_journal_file_inode()
2675 transaction->t_need_data_flush = 1; in jbd2_journal_file_inode()
2682 jinode->i_next_transaction = transaction; in jbd2_journal_file_inode()
2687 jinode->i_transaction = transaction; in jbd2_journal_file_inode()
2688 list_add(&jinode->i_list, &transaction->t_inode_list); in jbd2_journal_file_inode()