1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-21 15:45:02 +00:00

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: ...".
This commit is contained in:
Mike Pritchard 1997-02-10 17:05:30 +00:00
parent b49b12158f
commit 812ac98e83
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=22544

View File

@ -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);