diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/gfs2/trans.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'fs/gfs2/trans.c')
-rw-r--r-- | fs/gfs2/trans.c | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 413627072f3..9ec73a85411 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -50,7 +50,8 @@ 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 | sb_start_intwrite(sdp->sd_vfs); | 53 | INIT_LIST_HEAD(&tr->tr_list_buf); |
54 | |||
54 | gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); | 55 | gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); |
55 | 56 | ||
56 | error = gfs2_glock_nq(&tr->tr_t_gh); | 57 | error = gfs2_glock_nq(&tr->tr_t_gh); |
@@ -69,7 +70,6 @@ fail_gunlock: | |||
69 | gfs2_glock_dq(&tr->tr_t_gh); | 70 | gfs2_glock_dq(&tr->tr_t_gh); |
70 | 71 | ||
71 | fail_holder_uninit: | 72 | fail_holder_uninit: |
72 | sb_end_intwrite(sdp->sd_vfs); | ||
73 | gfs2_holder_uninit(&tr->tr_t_gh); | 73 | gfs2_holder_uninit(&tr->tr_t_gh); |
74 | kfree(tr); | 74 | kfree(tr); |
75 | 75 | ||
@@ -93,21 +93,10 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) | |||
93 | up_read(&sdp->sd_log_flush_lock); | 93 | up_read(&sdp->sd_log_flush_lock); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void gfs2_print_trans(const struct gfs2_trans *tr) | ||
97 | { | ||
98 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); | ||
99 | printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n", | ||
100 | tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched); | ||
101 | printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n", | ||
102 | tr->tr_num_buf_new, tr->tr_num_buf_rm, | ||
103 | tr->tr_num_databuf_new, tr->tr_num_databuf_rm, | ||
104 | tr->tr_num_revoke, tr->tr_num_revoke_rm); | ||
105 | } | ||
106 | |||
107 | void gfs2_trans_end(struct gfs2_sbd *sdp) | 96 | void gfs2_trans_end(struct gfs2_sbd *sdp) |
108 | { | 97 | { |
109 | struct gfs2_trans *tr = current->journal_info; | 98 | struct gfs2_trans *tr = current->journal_info; |
110 | s64 nbuf; | 99 | |
111 | BUG_ON(!tr); | 100 | BUG_ON(!tr); |
112 | current->journal_info = NULL; | 101 | current->journal_info = NULL; |
113 | 102 | ||
@@ -118,17 +107,19 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) | |||
118 | gfs2_holder_uninit(&tr->tr_t_gh); | 107 | gfs2_holder_uninit(&tr->tr_t_gh); |
119 | kfree(tr); | 108 | kfree(tr); |
120 | } | 109 | } |
121 | sb_end_intwrite(sdp->sd_vfs); | ||
122 | return; | 110 | return; |
123 | } | 111 | } |
124 | 112 | ||
125 | nbuf = tr->tr_num_buf_new + tr->tr_num_databuf_new; | 113 | if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) { |
126 | nbuf -= tr->tr_num_buf_rm; | 114 | fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u ", |
127 | nbuf -= tr->tr_num_databuf_rm; | 115 | tr->tr_num_buf, tr->tr_blocks); |
128 | 116 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); | |
129 | if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks) && | 117 | } |
130 | (tr->tr_num_revoke <= tr->tr_revokes))) | 118 | if (gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) { |
131 | gfs2_print_trans(tr); | 119 | fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u ", |
120 | tr->tr_num_revoke, tr->tr_revokes); | ||
121 | print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); | ||
122 | } | ||
132 | 123 | ||
133 | gfs2_log_commit(sdp, tr); | 124 | gfs2_log_commit(sdp, tr); |
134 | if (tr->tr_t_gh.gh_gl) { | 125 | if (tr->tr_t_gh.gh_gl) { |
@@ -139,7 +130,6 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) | |||
139 | 130 | ||
140 | if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) | 131 | if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) |
141 | gfs2_log_flush(sdp, NULL); | 132 | gfs2_log_flush(sdp, NULL); |
142 | sb_end_intwrite(sdp->sd_vfs); | ||
143 | } | 133 | } |
144 | 134 | ||
145 | /** | 135 | /** |
@@ -155,31 +145,23 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta) | |||
155 | struct gfs2_sbd *sdp = gl->gl_sbd; | 145 | struct gfs2_sbd *sdp = gl->gl_sbd; |
156 | struct gfs2_bufdata *bd; | 146 | struct gfs2_bufdata *bd; |
157 | 147 | ||
158 | lock_buffer(bh); | ||
159 | gfs2_log_lock(sdp); | ||
160 | bd = bh->b_private; | 148 | bd = bh->b_private; |
161 | if (bd) | 149 | if (bd) |
162 | gfs2_assert(sdp, bd->bd_gl == gl); | 150 | gfs2_assert(sdp, bd->bd_gl == gl); |
163 | else { | 151 | else { |
164 | gfs2_log_unlock(sdp); | ||
165 | unlock_buffer(bh); | ||
166 | gfs2_attach_bufdata(gl, bh, meta); | 152 | gfs2_attach_bufdata(gl, bh, meta); |
167 | bd = bh->b_private; | 153 | bd = bh->b_private; |
168 | lock_buffer(bh); | ||
169 | gfs2_log_lock(sdp); | ||
170 | } | 154 | } |
171 | lops_add(sdp, bd); | 155 | lops_add(sdp, &bd->bd_le); |
172 | gfs2_log_unlock(sdp); | ||
173 | unlock_buffer(bh); | ||
174 | } | 156 | } |
175 | 157 | ||
176 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) | 158 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) |
177 | { | 159 | { |
178 | BUG_ON(!list_empty(&bd->bd_list)); | 160 | BUG_ON(!list_empty(&bd->bd_le.le_list)); |
179 | BUG_ON(!list_empty(&bd->bd_ail_st_list)); | 161 | BUG_ON(!list_empty(&bd->bd_ail_st_list)); |
180 | BUG_ON(!list_empty(&bd->bd_ail_gl_list)); | 162 | BUG_ON(!list_empty(&bd->bd_ail_gl_list)); |
181 | lops_init_le(bd, &gfs2_revoke_lops); | 163 | lops_init_le(&bd->bd_le, &gfs2_revoke_lops); |
182 | lops_add(sdp, bd); | 164 | lops_add(sdp, &bd->bd_le); |
183 | } | 165 | } |
184 | 166 | ||
185 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) | 167 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) |
@@ -189,9 +171,9 @@ void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) | |||
189 | unsigned int n = len; | 171 | unsigned int n = len; |
190 | 172 | ||
191 | gfs2_log_lock(sdp); | 173 | gfs2_log_lock(sdp); |
192 | list_for_each_entry_safe(bd, tmp, &sdp->sd_log_le_revoke, bd_list) { | 174 | list_for_each_entry_safe(bd, tmp, &sdp->sd_log_le_revoke, bd_le.le_list) { |
193 | if ((bd->bd_blkno >= blkno) && (bd->bd_blkno < (blkno + len))) { | 175 | if ((bd->bd_blkno >= blkno) && (bd->bd_blkno < (blkno + len))) { |
194 | list_del_init(&bd->bd_list); | 176 | list_del_init(&bd->bd_le.le_list); |
195 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); | 177 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); |
196 | sdp->sd_log_num_revoke--; | 178 | sdp->sd_log_num_revoke--; |
197 | kmem_cache_free(gfs2_bufdata_cachep, bd); | 179 | kmem_cache_free(gfs2_bufdata_cachep, bd); |
@@ -203,3 +185,8 @@ void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) | |||
203 | gfs2_log_unlock(sdp); | 185 | gfs2_log_unlock(sdp); |
204 | } | 186 | } |
205 | 187 | ||
188 | void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd) | ||
189 | { | ||
190 | lops_add(rgd->rd_sbd, &rgd->rd_le); | ||
191 | } | ||
192 | |||