[GFS2] Fix some bugs
authorSteven Whitehouse <swhiteho@redhat.com>
Wed, 1 Mar 2006 22:41:58 +0000 (17:41 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Wed, 1 Mar 2006 22:41:58 +0000 (17:41 -0500)
Fix a bug I introduced earlier with a kfree() and usage of
a structure in the wrong order. Also try and get the counts
of the journaled data buffers "more correct". Still some work
to do in this area though.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/log.c
fs/gfs2/lops.c
fs/gfs2/trans.c

index 32a41a2..e6a84f7 100644 (file)
@@ -597,8 +597,6 @@ void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
        sdp->sd_vfs->s_dirt = 1;
        unlock_from_trans(sdp);
 
-       kfree(tr);
-
        gfs2_log_lock(sdp);
        if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) {
                gfs2_log_unlock(sdp);
index 430161a..9d40e21 100644 (file)
@@ -474,6 +474,7 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
                gfs2_trans_add_gl(bd->bd_gl);
                list_add(&bd->bd_list_tr, &tr->tr_list_buf);
                gfs2_pin(sdp, bd->bd_bh);
+               tr->tr_num_buf_new++;
        }
        gfs2_log_lock(sdp);
        if (!list_empty(&le->le_list)) {
index 5d1f4a1..63e7fed 100644 (file)
@@ -87,7 +87,6 @@ int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks,
 void gfs2_trans_end(struct gfs2_sbd *sdp)
 {
        struct gfs2_trans *tr;
-       struct gfs2_holder *t_gh;
 
        tr = current->journal_info;
        current->journal_info = NULL;
@@ -95,13 +94,11 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
        if (gfs2_assert_warn(sdp, tr))
                return;
 
-       t_gh = &tr->tr_t_gh;
-
        if (!tr->tr_touched) {
                gfs2_log_release(sdp, tr->tr_reserved);
 
-               gfs2_glock_dq(t_gh);
-               gfs2_holder_uninit(t_gh);
+               gfs2_glock_dq(&tr->tr_t_gh);
+               gfs2_holder_uninit(&tr->tr_t_gh);
 
                kfree(tr);
                return;
@@ -120,8 +117,10 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
 
        gfs2_log_commit(sdp, tr);
 
-       gfs2_glock_dq(t_gh);
-       gfs2_holder_uninit(t_gh);
+        gfs2_glock_dq(&tr->tr_t_gh);
+        gfs2_holder_uninit(&tr->tr_t_gh);
+
+        kfree(tr);
 
        if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS)
                gfs2_log_flush(sdp);