diff options
Diffstat (limited to 'fs/gfs2/trans.c')
-rw-r--r-- | fs/gfs2/trans.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 86ac75d99d31..ad3e2fb763d7 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -50,8 +50,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, | |||
50 | if (revokes) | 50 | if (revokes) |
51 | tr->tr_reserved += gfs2_struct2blk(sdp, revokes, | 51 | tr->tr_reserved += gfs2_struct2blk(sdp, revokes, |
52 | sizeof(u64)); | 52 | sizeof(u64)); |
53 | INIT_LIST_HEAD(&tr->tr_list_buf); | ||
54 | |||
55 | gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); | 53 | gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); |
56 | 54 | ||
57 | error = gfs2_glock_nq(&tr->tr_t_gh); | 55 | error = gfs2_glock_nq(&tr->tr_t_gh); |
@@ -93,10 +91,21 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) | |||
93 | up_read(&sdp->sd_log_flush_lock); | 91 | up_read(&sdp->sd_log_flush_lock); |
94 | } | 92 | } |
95 | 93 | ||
94 | static void gfs2_print_trans(const struct gfs2_trans *tr) | ||
95 | { | ||
96 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); | ||
97 | printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n", | ||
98 | tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched); | ||
99 | printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n", | ||
100 | tr->tr_num_buf_new, tr->tr_num_buf_rm, | ||
101 | tr->tr_num_databuf_new, tr->tr_num_databuf_rm, | ||
102 | tr->tr_num_revoke, tr->tr_num_revoke_rm); | ||
103 | } | ||
104 | |||
96 | void gfs2_trans_end(struct gfs2_sbd *sdp) | 105 | void gfs2_trans_end(struct gfs2_sbd *sdp) |
97 | { | 106 | { |
98 | struct gfs2_trans *tr = current->journal_info; | 107 | struct gfs2_trans *tr = current->journal_info; |
99 | 108 | s64 nbuf; | |
100 | BUG_ON(!tr); | 109 | BUG_ON(!tr); |
101 | current->journal_info = NULL; | 110 | current->journal_info = NULL; |
102 | 111 | ||
@@ -110,16 +119,13 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) | |||
110 | return; | 119 | return; |
111 | } | 120 | } |
112 | 121 | ||
113 | if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) { | 122 | nbuf = tr->tr_num_buf_new + tr->tr_num_databuf_new; |
114 | fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u ", | 123 | nbuf -= tr->tr_num_buf_rm; |
115 | tr->tr_num_buf, tr->tr_blocks); | 124 | nbuf -= tr->tr_num_databuf_rm; |
116 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); | 125 | |
117 | } | 126 | if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks) && |
118 | if (gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) { | 127 | (tr->tr_num_revoke <= tr->tr_revokes))) |
119 | fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u ", | 128 | gfs2_print_trans(tr); |
120 | tr->tr_num_revoke, tr->tr_revokes); | ||
121 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); | ||
122 | } | ||
123 | 129 | ||
124 | gfs2_log_commit(sdp, tr); | 130 | gfs2_log_commit(sdp, tr); |
125 | if (tr->tr_t_gh.gh_gl) { | 131 | if (tr->tr_t_gh.gh_gl) { |
@@ -152,16 +158,16 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta) | |||
152 | gfs2_attach_bufdata(gl, bh, meta); | 158 | gfs2_attach_bufdata(gl, bh, meta); |
153 | bd = bh->b_private; | 159 | bd = bh->b_private; |
154 | } | 160 | } |
155 | lops_add(sdp, &bd->bd_le); | 161 | lops_add(sdp, bd); |
156 | } | 162 | } |
157 | 163 | ||
158 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) | 164 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) |
159 | { | 165 | { |
160 | BUG_ON(!list_empty(&bd->bd_le.le_list)); | 166 | BUG_ON(!list_empty(&bd->bd_list)); |
161 | BUG_ON(!list_empty(&bd->bd_ail_st_list)); | 167 | BUG_ON(!list_empty(&bd->bd_ail_st_list)); |
162 | BUG_ON(!list_empty(&bd->bd_ail_gl_list)); | 168 | BUG_ON(!list_empty(&bd->bd_ail_gl_list)); |
163 | lops_init_le(&bd->bd_le, &gfs2_revoke_lops); | 169 | lops_init_le(bd, &gfs2_revoke_lops); |
164 | lops_add(sdp, &bd->bd_le); | 170 | lops_add(sdp, bd); |
165 | } | 171 | } |
166 | 172 | ||
167 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) | 173 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) |
@@ -171,9 +177,9 @@ void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) | |||
171 | unsigned int n = len; | 177 | unsigned int n = len; |
172 | 178 | ||
173 | gfs2_log_lock(sdp); | 179 | gfs2_log_lock(sdp); |
174 | list_for_each_entry_safe(bd, tmp, &sdp->sd_log_le_revoke, bd_le.le_list) { | 180 | list_for_each_entry_safe(bd, tmp, &sdp->sd_log_le_revoke, bd_list) { |
175 | if ((bd->bd_blkno >= blkno) && (bd->bd_blkno < (blkno + len))) { | 181 | if ((bd->bd_blkno >= blkno) && (bd->bd_blkno < (blkno + len))) { |
176 | list_del_init(&bd->bd_le.le_list); | 182 | list_del_init(&bd->bd_list); |
177 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); | 183 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); |
178 | sdp->sd_log_num_revoke--; | 184 | sdp->sd_log_num_revoke--; |
179 | kmem_cache_free(gfs2_bufdata_cachep, bd); | 185 | kmem_cache_free(gfs2_bufdata_cachep, bd); |