aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/trans.c30
2 files changed, 13 insertions, 19 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 2443e9aad59..c741016d07d 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -360,7 +360,7 @@ struct gfs2_trans {
360 unsigned int tr_revokes; 360 unsigned int tr_revokes;
361 unsigned int tr_reserved; 361 unsigned int tr_reserved;
362 362
363 struct gfs2_holder *tr_t_gh; 363 struct gfs2_holder tr_t_gh;
364 364
365 int tr_touched; 365 int tr_touched;
366 366
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 2cce68aec13..5d1f4a1e407 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -53,18 +53,15 @@ int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks,
53 sizeof(uint64_t)); 53 sizeof(uint64_t));
54 INIT_LIST_HEAD(&tr->tr_list_buf); 54 INIT_LIST_HEAD(&tr->tr_list_buf);
55 55
56 error = -ENOMEM; 56 gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED,
57 tr->tr_t_gh = gfs2_holder_get(sdp->sd_trans_gl, LM_ST_SHARED, 57 GL_NEVER_RECURSE, &tr->tr_t_gh);
58 GL_NEVER_RECURSE, GFP_NOFS);
59 if (!tr->tr_t_gh)
60 goto fail;
61 58
62 error = gfs2_glock_nq(tr->tr_t_gh); 59 error = gfs2_glock_nq(&tr->tr_t_gh);
63 if (error) 60 if (error)
64 goto fail_holder_put; 61 goto fail_holder_uninit;
65 62
66 if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { 63 if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
67 tr->tr_t_gh->gh_flags |= GL_NOCACHE; 64 tr->tr_t_gh.gh_flags |= GL_NOCACHE;
68 error = -EROFS; 65 error = -EROFS;
69 goto fail_gunlock; 66 goto fail_gunlock;
70 } 67 }
@@ -78,12 +75,10 @@ int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks,
78 return 0; 75 return 0;
79 76
80 fail_gunlock: 77 fail_gunlock:
81 gfs2_glock_dq(tr->tr_t_gh); 78 gfs2_glock_dq(&tr->tr_t_gh);
82 79
83 fail_holder_put: 80 fail_holder_uninit:
84 gfs2_holder_put(tr->tr_t_gh); 81 gfs2_holder_uninit(&tr->tr_t_gh);
85
86 fail:
87 kfree(tr); 82 kfree(tr);
88 83
89 return error; 84 return error;
@@ -100,16 +95,15 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
100 if (gfs2_assert_warn(sdp, tr)) 95 if (gfs2_assert_warn(sdp, tr))
101 return; 96 return;
102 97
103 t_gh = tr->tr_t_gh; 98 t_gh = &tr->tr_t_gh;
104 tr->tr_t_gh = NULL;
105 99
106 if (!tr->tr_touched) { 100 if (!tr->tr_touched) {
107 gfs2_log_release(sdp, tr->tr_reserved); 101 gfs2_log_release(sdp, tr->tr_reserved);
108 kfree(tr);
109 102
110 gfs2_glock_dq(t_gh); 103 gfs2_glock_dq(t_gh);
111 gfs2_holder_put(t_gh); 104 gfs2_holder_uninit(t_gh);
112 105
106 kfree(tr);
113 return; 107 return;
114 } 108 }
115 109
@@ -127,7 +121,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
127 gfs2_log_commit(sdp, tr); 121 gfs2_log_commit(sdp, tr);
128 122
129 gfs2_glock_dq(t_gh); 123 gfs2_glock_dq(t_gh);
130 gfs2_holder_put(t_gh); 124 gfs2_holder_uninit(t_gh);
131 125
132 if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) 126 if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)
133 gfs2_log_flush(sdp); 127 gfs2_log_flush(sdp);