aboutsummaryrefslogtreecommitdiff
path: root/fs/gfs2/rgrp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-14 10:00:29 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-14 10:00:29 -0700
commit28e8351ac22de25034e048c680014ad824323c65 (patch)
treefd4d137e9b761674096817943beec1936a4f702b /fs/gfs2/rgrp.c
parent3b993e8bee32d6dfe04df560eda8e1aff6248a22 (diff)
parentd18c4d687dd4625360ee14047d7eb454217719ee (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes: [GFS2] Revert remounting w/o acl option leaves acls enabled [GFS2] Fix setting of inherit jdata attr [GFS2] Fix incorrect error path in prepare_write() [GFS2] Fix incorrect return code in rgrp.c [GFS2] soft lockup in rgblk_search [GFS2] soft lockup detected in databuf_lo_before_commit [DLM] fix basts for granted PR waiting CW [DLM] More othercon fixes [DLM] Fix memory leak in dlm_add_member() when dlm_node_weight() returns less than zero [DLM] zero unused parts of sockaddr_storage [DLM] fix NULL ls usage [DLM] Clear othercon pointers when a connection is closed
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r--fs/gfs2/rgrp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index e4e04062515..ce48c4594ec 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -863,16 +863,19 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked)
u64 no_addr;
for(;;) {
+ if (goal >= rgd->rd_data)
+ break;
goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED,
GFS2_BLKST_UNLINKED);
- if (goal == 0)
- return 0;
+ if (goal == BFITNOENT)
+ break;
no_addr = goal + rgd->rd_data0;
- if (no_addr <= *last_unlinked)
+ goal++;
+ if (no_addr < *last_unlinked)
continue;
*last_unlinked = no_addr;
inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN,
- no_addr, -1);
+ no_addr, -1);
if (!IS_ERR(inode))
return inode;
}
@@ -1313,7 +1316,7 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
bi->bi_len, blk, new_state);
}
- return (blk == BFITNOENT) ? 0 : (bi->bi_start * GFS2_NBBY) + blk;
+ return (blk == BFITNOENT) ? blk : (bi->bi_start * GFS2_NBBY) + blk;
}
/**
@@ -1393,6 +1396,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip)
goal = rgd->rd_last_alloc_data;
blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED);
+ BUG_ON(blk == BFITNOENT);
rgd->rd_last_alloc_data = blk;
block = rgd->rd_data0 + blk;
@@ -1437,6 +1441,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip)
goal = rgd->rd_last_alloc_meta;
blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED);
+ BUG_ON(blk == BFITNOENT);
rgd->rd_last_alloc_meta = blk;
block = rgd->rd_data0 + blk;
@@ -1478,6 +1483,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation)
blk = rgblk_search(rgd, rgd->rd_last_alloc_meta,
GFS2_BLKST_FREE, GFS2_BLKST_DINODE);
+ BUG_ON(blk == BFITNOENT);
rgd->rd_last_alloc_meta = blk;