summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_alloc.c
diff options
context:
space:
mode:
authormpp <mpp@FreeBSD.org>1997-02-10 17:05:30 +0000
committermpp <mpp@FreeBSD.org>1997-02-10 17:05:30 +0000
commit34c278f97019681dab0812553ad732a5fd952417 (patch)
treefca86e748d6d828408e14f41b0e8f5f7fd84fbc5 /sys/ufs/ffs/ffs_alloc.c
parent7a838f1dcf524f73d23d0f3b05e07e8b020a5f2b (diff)
downloadFreeBSD-src-34c278f97019681dab0812553ad732a5fd952417.zip
FreeBSD-src-34c278f97019681dab0812553ad732a5fd952417.tar.gz
Correct the new Lite2 #ifdef DIAGNOSTIC ffs_checkblk routine
to not return without setting a return value when it can't read a block error or detects a bad cylinder group, since the caller is expecting a return value. It will now panic at this point, since the thing to do in this case would be to return a "bad block" status to the caller, and the caller will panic anyways when that happens. Also updated to panic strings in this routine to read "ffs_checkblk: ..." instead of "checkblk: ...".
Diffstat (limited to 'sys/ufs/ffs/ffs_alloc.c')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 4787c1c..dec4f75 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1360,6 +1360,7 @@ ffs_blkfree(ip, bno, size)
* Verify allocation of a block or fragment. Returns true if block or
* fragment is allocated, false if it is free.
*/
+int
ffs_checkblk(ip, bno, size)
struct inode *ip;
ufs_daddr_t bno;
@@ -1374,21 +1375,17 @@ ffs_checkblk(ip, bno, size)
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) {
printf("bsize = %d, size = %d, fs = %s\n",
fs->fs_bsize, size, fs->fs_fsmnt);
- panic("checkblk: bad size");
+ panic("ffs_checkblk: bad size");
}
if ((u_int)bno >= fs->fs_size)
- panic("checkblk: bad block %d", bno);
+ panic("ffs_checkblk: bad block %d", bno);
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, dtog(fs, bno))),
(int)fs->fs_cgsize, NOCRED, &bp);
- if (error) {
- brelse(bp);
- return;
- }
+ if (error)
+ panic("ffs_checkblk: cg bread failed");
cgp = (struct cg *)bp->b_data;
- if (!cg_chkmagic(cgp)) {
- brelse(bp);
- return;
- }
+ if (!cg_chkmagic(cgp))
+ panic("ffs_checkblk: cg magic mismatch");
bno = dtogd(fs, bno);
if (size == fs->fs_bsize) {
free = ffs_isblock(fs, cg_blksfree(cgp), fragstoblks(fs, bno));
@@ -1398,7 +1395,7 @@ ffs_checkblk(ip, bno, size)
if (isset(cg_blksfree(cgp), bno + i))
free++;
if (free != 0 && free != frags)
- panic("checkblk: partially free fragment");
+ panic("ffs_checkblk: partially free fragment");
}
brelse(bp);
return (!free);
OpenPOWER on IntegriCloud