Lines Matching refs:tr
28 static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr) in gfs2_print_trans() argument
30 fs_warn(sdp, "Transaction created at: %pSR\n", (void *)tr->tr_ip); in gfs2_print_trans()
32 tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, in gfs2_print_trans()
33 test_bit(TR_TOUCHED, &tr->tr_flags)); in gfs2_print_trans()
35 tr->tr_num_buf_new, tr->tr_num_buf_rm, in gfs2_print_trans()
36 tr->tr_num_databuf_new, tr->tr_num_databuf_rm, in gfs2_print_trans()
37 tr->tr_num_revoke); in gfs2_print_trans()
40 int __gfs2_trans_begin(struct gfs2_trans *tr, struct gfs2_sbd *sdp, in __gfs2_trans_begin() argument
55 tr->tr_ip = ip; in __gfs2_trans_begin()
56 tr->tr_blocks = blocks; in __gfs2_trans_begin()
57 tr->tr_revokes = revokes; in __gfs2_trans_begin()
58 tr->tr_reserved = GFS2_LOG_FLUSH_MIN_BLOCKS; in __gfs2_trans_begin()
65 tr->tr_reserved += blocks + 1 + DIV_ROUND_UP(blocks - 1, databuf_limit(sdp)); in __gfs2_trans_begin()
67 INIT_LIST_HEAD(&tr->tr_databuf); in __gfs2_trans_begin()
68 INIT_LIST_HEAD(&tr->tr_buf); in __gfs2_trans_begin()
69 INIT_LIST_HEAD(&tr->tr_list); in __gfs2_trans_begin()
70 INIT_LIST_HEAD(&tr->tr_ail1_list); in __gfs2_trans_begin()
71 INIT_LIST_HEAD(&tr->tr_ail2_list); in __gfs2_trans_begin()
73 if (gfs2_assert_warn(sdp, tr->tr_reserved <= sdp->sd_jdesc->jd_blocks)) in __gfs2_trans_begin()
88 if (gfs2_log_try_reserve(sdp, tr, &extra_revokes)) in __gfs2_trans_begin()
91 gfs2_log_reserve(sdp, tr, &extra_revokes); in __gfs2_trans_begin()
97 gfs2_log_release_revokes(sdp, tr->tr_revokes); in __gfs2_trans_begin()
99 gfs2_log_release(sdp, tr->tr_reserved); in __gfs2_trans_begin()
104 current->journal_info = tr; in __gfs2_trans_begin()
112 struct gfs2_trans *tr; in gfs2_trans_begin() local
115 tr = kmem_cache_zalloc(gfs2_trans_cachep, GFP_NOFS); in gfs2_trans_begin()
116 if (!tr) in gfs2_trans_begin()
118 error = __gfs2_trans_begin(tr, sdp, blocks, revokes, _RET_IP_); in gfs2_trans_begin()
120 kmem_cache_free(gfs2_trans_cachep, tr); in gfs2_trans_begin()
126 struct gfs2_trans *tr = current->journal_info; in gfs2_trans_end() local
131 if (!test_bit(TR_TOUCHED, &tr->tr_flags)) { in gfs2_trans_end()
132 gfs2_log_release_revokes(sdp, tr->tr_revokes); in gfs2_trans_end()
134 gfs2_log_release(sdp, tr->tr_reserved); in gfs2_trans_end()
135 if (!test_bit(TR_ONSTACK, &tr->tr_flags)) in gfs2_trans_end()
136 gfs2_trans_free(sdp, tr); in gfs2_trans_end()
141 gfs2_log_release_revokes(sdp, tr->tr_revokes - tr->tr_num_revoke); in gfs2_trans_end()
143 nbuf = tr->tr_num_buf_new + tr->tr_num_databuf_new; in gfs2_trans_end()
144 nbuf -= tr->tr_num_buf_rm; in gfs2_trans_end()
145 nbuf -= tr->tr_num_databuf_rm; in gfs2_trans_end()
147 if (gfs2_assert_withdraw(sdp, nbuf <= tr->tr_blocks) || in gfs2_trans_end()
148 gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) in gfs2_trans_end()
149 gfs2_print_trans(sdp, tr); in gfs2_trans_end()
151 gfs2_log_commit(sdp, tr); in gfs2_trans_end()
152 if (!test_bit(TR_ONSTACK, &tr->tr_flags) && in gfs2_trans_end()
153 !test_bit(TR_ATTACHED, &tr->tr_flags)) in gfs2_trans_end()
154 gfs2_trans_free(sdp, tr); in gfs2_trans_end()
194 struct gfs2_trans *tr = current->journal_info; in gfs2_trans_add_data() local
200 set_bit(TR_TOUCHED, &tr->tr_flags); in gfs2_trans_add_data()
216 set_bit(TR_TOUCHED, &tr->tr_flags); in gfs2_trans_add_data()
221 tr->tr_num_databuf_new++; in gfs2_trans_add_data()
222 list_add_tail(&bd->bd_list, &tr->tr_databuf); in gfs2_trans_add_data()
236 struct gfs2_trans *tr = current->journal_info; in gfs2_trans_add_meta() local
241 set_bit(TR_TOUCHED, &tr->tr_flags); in gfs2_trans_add_meta()
259 set_bit(TR_TOUCHED, &tr->tr_flags); in gfs2_trans_add_meta()
284 list_add(&bd->bd_list, &tr->tr_buf); in gfs2_trans_add_meta()
285 tr->tr_num_buf_new++; in gfs2_trans_add_meta()
296 struct gfs2_trans *tr = current->journal_info; in gfs2_trans_add_revoke() local
300 set_bit(TR_TOUCHED, &tr->tr_flags); in gfs2_trans_add_revoke()
301 tr->tr_num_revoke++; in gfs2_trans_add_revoke()
326 void gfs2_trans_free(struct gfs2_sbd *sdp, struct gfs2_trans *tr) in gfs2_trans_free() argument
328 if (tr == NULL) in gfs2_trans_free()
331 gfs2_assert_warn(sdp, list_empty(&tr->tr_ail1_list)); in gfs2_trans_free()
332 gfs2_assert_warn(sdp, list_empty(&tr->tr_ail2_list)); in gfs2_trans_free()
333 gfs2_assert_warn(sdp, list_empty(&tr->tr_databuf)); in gfs2_trans_free()
334 gfs2_assert_warn(sdp, list_empty(&tr->tr_buf)); in gfs2_trans_free()
335 kmem_cache_free(gfs2_trans_cachep, tr); in gfs2_trans_free()