diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-07-17 05:26:56 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-08-14 05:33:15 -0400 |
commit | 6eefaf61f664053c1dd6534a994cab3f8bb07263 (patch) | |
tree | fddd9218cd7ac92f8f2b850c52d4b2dbca7fb568 /fs/gfs2 | |
parent | 24c7387333c77b602ece7ecd6a85fc94f8f16d8c (diff) |
[GFS2] Fix incorrect return code in rgrp.c
The following patch fixes a bug where 0 was being used as a return code
to indicate "nothing to do" when in fact 0 was a valid block location
which might be returned by the function.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/rgrp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index bb58e69fd977..ce48c4594ec8 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -867,7 +867,7 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked) | |||
867 | break; | 867 | break; |
868 | goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, | 868 | goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, |
869 | GFS2_BLKST_UNLINKED); | 869 | GFS2_BLKST_UNLINKED); |
870 | if (goal == 0) | 870 | if (goal == BFITNOENT) |
871 | break; | 871 | break; |
872 | no_addr = goal + rgd->rd_data0; | 872 | no_addr = goal + rgd->rd_data0; |
873 | goal++; | 873 | goal++; |
@@ -1316,7 +1316,7 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | |||
1316 | bi->bi_len, blk, new_state); | 1316 | bi->bi_len, blk, new_state); |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | return (blk == BFITNOENT) ? 0 : (bi->bi_start * GFS2_NBBY) + blk; | 1319 | return (blk == BFITNOENT) ? blk : (bi->bi_start * GFS2_NBBY) + blk; |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | /** | 1322 | /** |
@@ -1396,6 +1396,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1396 | goal = rgd->rd_last_alloc_data; | 1396 | goal = rgd->rd_last_alloc_data; |
1397 | 1397 | ||
1398 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); | 1398 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); |
1399 | BUG_ON(blk == BFITNOENT); | ||
1399 | rgd->rd_last_alloc_data = blk; | 1400 | rgd->rd_last_alloc_data = blk; |
1400 | 1401 | ||
1401 | block = rgd->rd_data0 + blk; | 1402 | block = rgd->rd_data0 + blk; |
@@ -1440,6 +1441,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1440 | goal = rgd->rd_last_alloc_meta; | 1441 | goal = rgd->rd_last_alloc_meta; |
1441 | 1442 | ||
1442 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); | 1443 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); |
1444 | BUG_ON(blk == BFITNOENT); | ||
1443 | rgd->rd_last_alloc_meta = blk; | 1445 | rgd->rd_last_alloc_meta = blk; |
1444 | 1446 | ||
1445 | block = rgd->rd_data0 + blk; | 1447 | block = rgd->rd_data0 + blk; |
@@ -1481,6 +1483,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | |||
1481 | 1483 | ||
1482 | blk = rgblk_search(rgd, rgd->rd_last_alloc_meta, | 1484 | blk = rgblk_search(rgd, rgd->rd_last_alloc_meta, |
1483 | GFS2_BLKST_FREE, GFS2_BLKST_DINODE); | 1485 | GFS2_BLKST_FREE, GFS2_BLKST_DINODE); |
1486 | BUG_ON(blk == BFITNOENT); | ||
1484 | 1487 | ||
1485 | rgd->rd_last_alloc_meta = blk; | 1488 | rgd->rd_last_alloc_meta = blk; |
1486 | 1489 | ||