aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/trans.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2007-09-03 06:01:33 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-10-10 03:56:12 -0400
commit1ad38c437fa33f85ba4b6a85ea8c5478ee72d5bd (patch)
tree11a5fc7993ba9ae343fc72f03f9a11f312fd6128 /fs/gfs2/trans.c
parent0820ab517e1b100ee3f9584ec27f93309689ebe7 (diff)
[GFS2] Clean up gfs2_trans_add_revoke()
The following alters gfs2_trans_add_revoke() to take a struct gfs2_bufdata as an argument. This eliminates the memory allocation which was previously required by making use of the already existing struct gfs2_bufdata. It makes some sanity checks to ensure that the gfs2_bufdata has been removed from all the lists before its recycled as a revoke structure. This saves one memory allocation and one free per revoke structure. Also as a result, and to simplify the locking, since there is no longer any blocking code in gfs2_trans_add_revoke() we must hold the log lock whenever this function is called. This reduces the amount of times we take and unlock the log lock. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/trans.c')
-rw-r--r--fs/gfs2/trans.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 01cc27fefd84..717983e2c2ae 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -142,12 +142,12 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
142 lops_add(sdp, &bd->bd_le); 142 lops_add(sdp, &bd->bd_le);
143} 143}
144 144
145void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, u64 blkno) 145void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
146{ 146{
147 struct gfs2_bufdata *bd = kmem_cache_alloc(gfs2_bufdata_cachep, 147 BUG_ON(!list_empty(&bd->bd_le.le_list));
148 GFP_NOFS | __GFP_NOFAIL); 148 BUG_ON(!list_empty(&bd->bd_ail_st_list));
149 BUG_ON(!list_empty(&bd->bd_ail_gl_list));
149 lops_init_le(&bd->bd_le, &gfs2_revoke_lops); 150 lops_init_le(&bd->bd_le, &gfs2_revoke_lops);
150 bd->bd_blkno = blkno;
151 lops_add(sdp, &bd->bd_le); 151 lops_add(sdp, &bd->bd_le);
152} 152}
153 153
@@ -160,7 +160,7 @@ void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno)
160 160
161 list_for_each_entry(bd, &sdp->sd_log_le_revoke, bd_le.le_list) { 161 list_for_each_entry(bd, &sdp->sd_log_le_revoke, bd_le.le_list) {
162 if (bd->bd_blkno == blkno) { 162 if (bd->bd_blkno == blkno) {
163 list_del(&bd->bd_le.le_list); 163 list_del_init(&bd->bd_le.le_list);
164 gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); 164 gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke);
165 sdp->sd_log_num_revoke--; 165 sdp->sd_log_num_revoke--;
166 found = 1; 166 found = 1;