提交 d24e0569 编写于 作者: B Bob Peterson 提交者: Steven Whitehouse

GFS2: Use gfs2_rbm_incr in rgblk_free

This patch speeds up GFS2 unlink operations by using function
gfs2_rbm_incr rather than continuously calculating the rbm.
Signed-off-by: NBob Peterson <rpeterso@redhat.com>
Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
上级 19aeb5a6
...@@ -2097,7 +2097,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, ...@@ -2097,7 +2097,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
u32 blen, unsigned char new_state) u32 blen, unsigned char new_state)
{ {
struct gfs2_rbm rbm; struct gfs2_rbm rbm;
struct gfs2_bitmap *bi; struct gfs2_bitmap *bi, *bi_prev = NULL;
rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1); rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1);
if (!rbm.rgd) { if (!rbm.rgd) {
...@@ -2106,18 +2106,22 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, ...@@ -2106,18 +2106,22 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
return NULL; return NULL;
} }
gfs2_rbm_from_block(&rbm, bstart);
while (blen--) { while (blen--) {
gfs2_rbm_from_block(&rbm, bstart);
bi = rbm_bi(&rbm); bi = rbm_bi(&rbm);
bstart++; if (bi != bi_prev) {
if (!bi->bi_clone) { if (!bi->bi_clone) {
bi->bi_clone = kmalloc(bi->bi_bh->b_size, bi->bi_clone = kmalloc(bi->bi_bh->b_size,
GFP_NOFS | __GFP_NOFAIL); GFP_NOFS | __GFP_NOFAIL);
memcpy(bi->bi_clone + bi->bi_offset, memcpy(bi->bi_clone + bi->bi_offset,
bi->bi_bh->b_data + bi->bi_offset, bi->bi_len); bi->bi_bh->b_data + bi->bi_offset,
bi->bi_len);
}
gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
bi_prev = bi;
} }
gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
gfs2_setbit(&rbm, false, new_state); gfs2_setbit(&rbm, false, new_state);
gfs2_rbm_incr(&rbm);
} }
return rbm.rgd; return rbm.rgd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册