diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/rgrp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index b93ac45b88bb..2d7f7ea0c9a8 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -865,12 +865,15 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked) | |||
865 | struct inode *inode; | 865 | struct inode *inode; |
866 | u32 goal = 0, block; | 866 | u32 goal = 0, block; |
867 | u64 no_addr; | 867 | u64 no_addr; |
868 | struct gfs2_sbd *sdp = rgd->rd_sbd; | ||
868 | 869 | ||
869 | for(;;) { | 870 | for(;;) { |
870 | if (goal >= rgd->rd_data) | 871 | if (goal >= rgd->rd_data) |
871 | break; | 872 | break; |
873 | down_write(&sdp->sd_log_flush_lock); | ||
872 | block = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, | 874 | block = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, |
873 | GFS2_BLKST_UNLINKED); | 875 | GFS2_BLKST_UNLINKED); |
876 | up_write(&sdp->sd_log_flush_lock); | ||
874 | if (block == BFITNOENT) | 877 | if (block == BFITNOENT) |
875 | break; | 878 | break; |
876 | /* rgblk_search can return a block < goal, so we need to | 879 | /* rgblk_search can return a block < goal, so we need to |
@@ -1295,7 +1298,9 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | |||
1295 | allocatable block anywhere else, we want to be able wrap around and | 1298 | allocatable block anywhere else, we want to be able wrap around and |
1296 | search in the first part of our first-searched bit block. */ | 1299 | search in the first part of our first-searched bit block. */ |
1297 | for (x = 0; x <= length; x++) { | 1300 | for (x = 0; x <= length; x++) { |
1298 | if (bi->bi_clone) | 1301 | /* The GFS2_BLKST_UNLINKED state doesn't apply to the clone |
1302 | bitmaps, so we must search the originals for that. */ | ||
1303 | if (old_state != GFS2_BLKST_UNLINKED && bi->bi_clone) | ||
1299 | blk = gfs2_bitfit(rgd, bi->bi_clone + bi->bi_offset, | 1304 | blk = gfs2_bitfit(rgd, bi->bi_clone + bi->bi_offset, |
1300 | bi->bi_len, goal, old_state); | 1305 | bi->bi_len, goal, old_state); |
1301 | else | 1306 | else |