diff options
-rw-r--r-- | fs/gfs2/bmap.c | 7 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 2 | ||||
-rw-r--r-- | fs/gfs2/eattr.c | 6 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 3 | ||||
-rw-r--r-- | fs/gfs2/trans.c | 25 | ||||
-rw-r--r-- | fs/gfs2/trans.h | 2 |
6 files changed, 21 insertions, 24 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 30d718b3438f..651e5320bb4f 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -138,7 +138,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page) | |||
138 | 138 | ||
139 | if (isdir) { | 139 | if (isdir) { |
140 | block = gfs2_alloc_meta(ip); | 140 | block = gfs2_alloc_meta(ip); |
141 | 141 | gfs2_trans_add_unrevoke(GFS2_SB(&ip->i_inode), block, 1); | |
142 | error = gfs2_dir_get_new_buffer(ip, block, &bh); | 142 | error = gfs2_dir_get_new_buffer(ip, block, &bh); |
143 | if (error) | 143 | if (error) |
144 | goto out_brelse; | 144 | goto out_brelse; |
@@ -206,6 +206,7 @@ static int build_height(struct inode *inode, struct metapath *mp, unsigned heigh | |||
206 | 206 | ||
207 | for(n = 0; n < new_height; n++) { | 207 | for(n = 0; n < new_height; n++) { |
208 | bn = gfs2_alloc_meta(ip); | 208 | bn = gfs2_alloc_meta(ip); |
209 | gfs2_trans_add_unrevoke(GFS2_SB(inode), bn, 1); | ||
209 | mp->mp_bh[n] = gfs2_meta_new(ip->i_gl, bn); | 210 | mp->mp_bh[n] = gfs2_meta_new(ip->i_gl, bn); |
210 | gfs2_trans_add_bh(ip->i_gl, mp->mp_bh[n], 1); | 211 | gfs2_trans_add_bh(ip->i_gl, mp->mp_bh[n], 1); |
211 | } | 212 | } |
@@ -370,8 +371,10 @@ static int lookup_block(struct gfs2_inode *ip, unsigned int height, | |||
370 | 371 | ||
371 | if (height == ip->i_height - 1 && !gfs2_is_dir(ip)) | 372 | if (height == ip->i_height - 1 && !gfs2_is_dir(ip)) |
372 | *block = gfs2_alloc_data(ip); | 373 | *block = gfs2_alloc_data(ip); |
373 | else | 374 | else { |
374 | *block = gfs2_alloc_meta(ip); | 375 | *block = gfs2_alloc_meta(ip); |
376 | gfs2_trans_add_unrevoke(GFS2_SB(&ip->i_inode), *block, 1); | ||
377 | } | ||
375 | 378 | ||
376 | gfs2_trans_add_bh(ip->i_gl, mp->mp_bh[height], 1); | 379 | gfs2_trans_add_bh(ip->i_gl, mp->mp_bh[height], 1); |
377 | 380 | ||
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 081daa96a9d9..55514ee06dd8 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -810,7 +810,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh, | |||
810 | struct qstr name = { .name = "", .len = 0, .hash = 0 }; | 810 | struct qstr name = { .name = "", .len = 0, .hash = 0 }; |
811 | if (!bh) | 811 | if (!bh) |
812 | return NULL; | 812 | return NULL; |
813 | 813 | gfs2_trans_add_unrevoke(GFS2_SB(inode), bn, 1); | |
814 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 814 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
815 | gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF); | 815 | gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF); |
816 | leaf = (struct gfs2_leaf *)bh->b_data; | 816 | leaf = (struct gfs2_leaf *)bh->b_data; |
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c index 04febbc17a16..c7fa0a8b1648 100644 --- a/fs/gfs2/eattr.c +++ b/fs/gfs2/eattr.c | |||
@@ -585,7 +585,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp) | |||
585 | u64 block; | 585 | u64 block; |
586 | 586 | ||
587 | block = gfs2_alloc_meta(ip); | 587 | block = gfs2_alloc_meta(ip); |
588 | 588 | gfs2_trans_add_unrevoke(sdp, block, 1); | |
589 | *bhp = gfs2_meta_new(ip->i_gl, block); | 589 | *bhp = gfs2_meta_new(ip->i_gl, block); |
590 | gfs2_trans_add_bh(ip->i_gl, *bhp, 1); | 590 | gfs2_trans_add_bh(ip->i_gl, *bhp, 1); |
591 | gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA); | 591 | gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA); |
@@ -644,7 +644,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, | |||
644 | int mh_size = sizeof(struct gfs2_meta_header); | 644 | int mh_size = sizeof(struct gfs2_meta_header); |
645 | 645 | ||
646 | block = gfs2_alloc_meta(ip); | 646 | block = gfs2_alloc_meta(ip); |
647 | 647 | gfs2_trans_add_unrevoke(sdp, block, 1); | |
648 | bh = gfs2_meta_new(ip->i_gl, block); | 648 | bh = gfs2_meta_new(ip->i_gl, block); |
649 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 649 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
650 | gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); | 650 | gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); |
@@ -968,7 +968,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, | |||
968 | u64 blk; | 968 | u64 blk; |
969 | 969 | ||
970 | blk = gfs2_alloc_meta(ip); | 970 | blk = gfs2_alloc_meta(ip); |
971 | 971 | gfs2_trans_add_unrevoke(sdp, blk, 1); | |
972 | indbh = gfs2_meta_new(ip->i_gl, blk); | 972 | indbh = gfs2_meta_new(ip->i_gl, blk); |
973 | gfs2_trans_add_bh(ip->i_gl, indbh, 1); | 973 | gfs2_trans_add_bh(ip->i_gl, indbh, 1); |
974 | gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); | 974 | gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index cc28845ba6fd..9f28463e62e5 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1486,7 +1486,6 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1486 | 1486 | ||
1487 | gfs2_statfs_change(sdp, 0, -1, 0); | 1487 | gfs2_statfs_change(sdp, 0, -1, 0); |
1488 | gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid); | 1488 | gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid); |
1489 | gfs2_trans_add_unrevoke(sdp, block); | ||
1490 | 1489 | ||
1491 | spin_lock(&sdp->sd_rindex_spin); | 1490 | spin_lock(&sdp->sd_rindex_spin); |
1492 | rgd->rd_free_clone--; | 1491 | rgd->rd_free_clone--; |
@@ -1528,7 +1527,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | |||
1528 | al->al_alloced++; | 1527 | al->al_alloced++; |
1529 | 1528 | ||
1530 | gfs2_statfs_change(sdp, 0, -1, +1); | 1529 | gfs2_statfs_change(sdp, 0, -1, +1); |
1531 | gfs2_trans_add_unrevoke(sdp, block); | 1530 | gfs2_trans_add_unrevoke(sdp, block, 1); |
1532 | 1531 | ||
1533 | spin_lock(&sdp->sd_rindex_spin); | 1532 | spin_lock(&sdp->sd_rindex_spin); |
1534 | rgd->rd_free_clone--; | 1533 | rgd->rd_free_clone--; |
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 73e5d92a657c..f677b8a83f0c 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -146,30 +146,25 @@ void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) | |||
146 | lops_add(sdp, &bd->bd_le); | 146 | lops_add(sdp, &bd->bd_le); |
147 | } | 147 | } |
148 | 148 | ||
149 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno) | 149 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) |
150 | { | 150 | { |
151 | struct gfs2_bufdata *bd; | 151 | struct gfs2_bufdata *bd, *tmp; |
152 | int found = 0; | 152 | struct gfs2_trans *tr = current->journal_info; |
153 | unsigned int n = len; | ||
153 | 154 | ||
154 | gfs2_log_lock(sdp); | 155 | gfs2_log_lock(sdp); |
155 | 156 | list_for_each_entry_safe(bd, tmp, &sdp->sd_log_le_revoke, bd_le.le_list) { | |
156 | list_for_each_entry(bd, &sdp->sd_log_le_revoke, bd_le.le_list) { | 157 | if ((bd->bd_blkno >= blkno) && (bd->bd_blkno < (blkno + len))) { |
157 | if (bd->bd_blkno == blkno) { | ||
158 | list_del_init(&bd->bd_le.le_list); | 158 | list_del_init(&bd->bd_le.le_list); |
159 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); | 159 | gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); |
160 | sdp->sd_log_num_revoke--; | 160 | sdp->sd_log_num_revoke--; |
161 | found = 1; | 161 | kmem_cache_free(gfs2_bufdata_cachep, bd); |
162 | break; | 162 | tr->tr_num_revoke_rm++; |
163 | if (--n == 0) | ||
164 | break; | ||
163 | } | 165 | } |
164 | } | 166 | } |
165 | |||
166 | gfs2_log_unlock(sdp); | 167 | gfs2_log_unlock(sdp); |
167 | |||
168 | if (found) { | ||
169 | struct gfs2_trans *tr = current->journal_info; | ||
170 | kmem_cache_free(gfs2_bufdata_cachep, bd); | ||
171 | tr->tr_num_revoke_rm++; | ||
172 | } | ||
173 | } | 168 | } |
174 | 169 | ||
175 | void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd) | 170 | void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd) |
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h index e826f0dab80a..edf9d4bd908e 100644 --- a/fs/gfs2/trans.h +++ b/fs/gfs2/trans.h | |||
@@ -32,7 +32,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp); | |||
32 | 32 | ||
33 | void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta); | 33 | void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta); |
34 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd); | 34 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd); |
35 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno); | 35 | void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len); |
36 | void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd); | 36 | void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd); |
37 | 37 | ||
38 | #endif /* __TRANS_DOT_H__ */ | 38 | #endif /* __TRANS_DOT_H__ */ |