Lines Matching refs:tr
28 static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
30 fs_warn(sdp, "Transaction created at: %pSR\n", (void *)tr->tr_ip);
32 tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
33 test_bit(TR_TOUCHED, &tr->tr_flags));
35 tr->tr_num_buf_new, tr->tr_num_buf_rm,
36 tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
37 tr->tr_num_revoke, tr->tr_num_revoke_rm);
43 struct gfs2_trans *tr;
55 tr = kmem_cache_zalloc(gfs2_trans_cachep, GFP_NOFS);
56 if (!tr)
59 tr->tr_ip = _RET_IP_;
60 tr->tr_blocks = blocks;
61 tr->tr_revokes = revokes;
62 tr->tr_reserved = 1;
63 set_bit(TR_ALLOCED, &tr->tr_flags);
65 tr->tr_reserved += 6 + blocks;
67 tr->tr_reserved += gfs2_struct2blk(sdp, revokes);
68 INIT_LIST_HEAD(&tr->tr_databuf);
69 INIT_LIST_HEAD(&tr->tr_buf);
70 INIT_LIST_HEAD(&tr->tr_list);
71 INIT_LIST_HEAD(&tr->tr_ail1_list);
72 INIT_LIST_HEAD(&tr->tr_ail2_list);
76 error = gfs2_log_reserve(sdp, tr->tr_reserved);
80 current->journal_info = tr;
86 kmem_cache_free(gfs2_trans_cachep, tr);
93 struct gfs2_trans *tr = current->journal_info;
95 int alloced = test_bit(TR_ALLOCED, &tr->tr_flags);
99 if (!test_bit(TR_TOUCHED, &tr->tr_flags)) {
100 gfs2_log_release(sdp, tr->tr_reserved);
102 gfs2_trans_free(sdp, tr);
108 nbuf = tr->tr_num_buf_new + tr->tr_num_databuf_new;
109 nbuf -= tr->tr_num_buf_rm;
110 nbuf -= tr->tr_num_databuf_rm;
112 if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks) &&
113 (tr->tr_num_revoke <= tr->tr_revokes)))
114 gfs2_print_trans(sdp, tr);
116 gfs2_log_commit(sdp, tr);
117 if (alloced && !test_bit(TR_ATTACHED, &tr->tr_flags))
118 gfs2_trans_free(sdp, tr);
159 struct gfs2_trans *tr = current->journal_info;
165 set_bit(TR_TOUCHED, &tr->tr_flags);
181 set_bit(TR_TOUCHED, &tr->tr_flags);
186 tr->tr_num_databuf_new++;
187 list_add_tail(&bd->bd_list, &tr->tr_databuf);
200 struct gfs2_trans *tr = current->journal_info;
205 set_bit(TR_TOUCHED, &tr->tr_flags);
223 set_bit(TR_TOUCHED, &tr->tr_flags);
246 list_add(&bd->bd_list, &tr->tr_buf);
247 tr->tr_num_buf_new++;
256 struct gfs2_trans *tr = current->journal_info;
260 set_bit(TR_TOUCHED, &tr->tr_flags);
261 tr->tr_num_revoke++;
267 struct gfs2_trans *tr = current->journal_info;
279 tr->tr_num_revoke_rm++;
287 void gfs2_trans_free(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
289 if (tr == NULL)
292 gfs2_assert_warn(sdp, list_empty(&tr->tr_ail1_list));
293 gfs2_assert_warn(sdp, list_empty(&tr->tr_ail2_list));
294 gfs2_assert_warn(sdp, list_empty(&tr->tr_databuf));
295 gfs2_assert_warn(sdp, list_empty(&tr->tr_buf));
296 kmem_cache_free(gfs2_trans_cachep, tr);