diff options
-rw-r--r-- | fs/gfs2/rgrp.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 55ef72dc5b13..7474c413ffd1 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -2097,7 +2097,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
2097 | u32 blen, unsigned char new_state) | 2097 | u32 blen, unsigned char new_state) |
2098 | { | 2098 | { |
2099 | struct gfs2_rbm rbm; | 2099 | struct gfs2_rbm rbm; |
2100 | struct gfs2_bitmap *bi; | 2100 | struct gfs2_bitmap *bi, *bi_prev = NULL; |
2101 | 2101 | ||
2102 | rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1); | 2102 | rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1); |
2103 | if (!rbm.rgd) { | 2103 | if (!rbm.rgd) { |
@@ -2106,18 +2106,22 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
2106 | return NULL; | 2106 | return NULL; |
2107 | } | 2107 | } |
2108 | 2108 | ||
2109 | gfs2_rbm_from_block(&rbm, bstart); | ||
2109 | while (blen--) { | 2110 | while (blen--) { |
2110 | gfs2_rbm_from_block(&rbm, bstart); | ||
2111 | bi = rbm_bi(&rbm); | 2111 | bi = rbm_bi(&rbm); |
2112 | bstart++; | 2112 | if (bi != bi_prev) { |
2113 | if (!bi->bi_clone) { | 2113 | if (!bi->bi_clone) { |
2114 | bi->bi_clone = kmalloc(bi->bi_bh->b_size, | 2114 | bi->bi_clone = kmalloc(bi->bi_bh->b_size, |
2115 | GFP_NOFS | __GFP_NOFAIL); | 2115 | GFP_NOFS | __GFP_NOFAIL); |
2116 | memcpy(bi->bi_clone + bi->bi_offset, | 2116 | memcpy(bi->bi_clone + bi->bi_offset, |
2117 | bi->bi_bh->b_data + bi->bi_offset, bi->bi_len); | 2117 | bi->bi_bh->b_data + bi->bi_offset, |
2118 | bi->bi_len); | ||
2119 | } | ||
2120 | gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh); | ||
2121 | bi_prev = bi; | ||
2118 | } | 2122 | } |
2119 | gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh); | ||
2120 | gfs2_setbit(&rbm, false, new_state); | 2123 | gfs2_setbit(&rbm, false, new_state); |
2124 | gfs2_rbm_incr(&rbm); | ||
2121 | } | 2125 | } |
2122 | 2126 | ||
2123 | return rbm.rgd; | 2127 | return rbm.rgd; |