aboutsummaryrefslogtreecommitdiff
path: root/fs/gfs2/trans.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-11 14:49:06 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-11 14:49:06 -0400
commitf4154ea039bbf45c52840b30c68143a2dc28d4b4 (patch)
treefa00645dd60a9140e885be96a4aa9797cf4cfeac /fs/gfs2/trans.c
parented3865079b573ef55dc13ab0bfb242ed5ebab4c1 (diff)
[GFS2] Update journal accounting code.
A small update to the journaling code to change the way that the "extra" blocks are accounted for in the journal. These are used at a rate of one per 503 metadata blocks or one per 251 journaled data blocks (or just one if the total number of journaled blocks in the transaction is smaller). Since we are using them at two different rates the old method of accounting for them no longer works and we count them up as required. Since the "per transaction" accounting can't handle this (there is no fixed number of header blocks per transaction) we have to account for it in the general journal code. We now require that each transaction reserves more blocks than it actually needs to take account of the possible extra blocks. Also a final fix to dir.c to ensure that all ref counts are handled correctly. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/trans.c')
-rw-r--r--fs/gfs2/trans.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 061f4a9a1db..6b02d8c38f0 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -44,7 +44,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
tr->tr_revokes = revokes;
tr->tr_reserved = 1;
if (blocks)
- tr->tr_reserved += 1 + blocks;
+ tr->tr_reserved += 6 + blocks;
if (revokes)
tr->tr_reserved += gfs2_struct2blk(sdp, revokes,
sizeof(uint64_t));
@@ -83,20 +83,15 @@ fail_holder_uninit:
void gfs2_trans_end(struct gfs2_sbd *sdp)
{
- struct gfs2_trans *tr;
+ struct gfs2_trans *tr = current->journal_info;
- tr = current->journal_info;
+ BUG_ON(!tr);
current->journal_info = NULL;
- if (gfs2_assert_warn(sdp, tr))
- return;
-
if (!tr->tr_touched) {
gfs2_log_release(sdp, tr->tr_reserved);
-
gfs2_glock_dq(&tr->tr_t_gh);
gfs2_holder_uninit(&tr->tr_t_gh);
-
kfree(tr);
return;
}
@@ -113,10 +108,8 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
}
gfs2_log_commit(sdp, tr);
-
gfs2_glock_dq(&tr->tr_t_gh);
gfs2_holder_uninit(&tr->tr_t_gh);
-
kfree(tr);
if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)