Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck_lfs Fixed blockmap handling to properly use disk b...
details: https://anonhg.NetBSD.org/src/rev/8a5c595bb561
branches: trunk
changeset: 501743:8a5c595bb561
user: joff <joff%NetBSD.org@localhost>
date: Sat Jan 06 23:08:24 2001 +0000
description:
Fixed blockmap handling to properly use disk blocks rather than fragments.
Fixes an issue with fsck_lfs not detecting all duplicate blocks that may
exist in a corrupted filesystem.
diffstat:
sbin/fsck_lfs/inode.c | 4 ++--
sbin/fsck_lfs/pass1.c | 9 ++++-----
sbin/fsck_lfs/pass4.c | 6 +++---
3 files changed, 9 insertions(+), 10 deletions(-)
diffs (81 lines):
diff -r 5f99bc3cb900 -r 8a5c595bb561 sbin/fsck_lfs/inode.c
--- a/sbin/fsck_lfs/inode.c Sat Jan 06 22:50:00 2001 +0000
+++ b/sbin/fsck_lfs/inode.c Sat Jan 06 23:08:24 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.8 2001/01/05 02:02:58 lukem Exp $ */
+/* $NetBSD: inode.c,v 1.9 2001/01/06 23:08:24 joff Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -468,7 +468,7 @@
return (n);
} else
func = dirscan;
- if (chkrange(idesc->id_blkno, idesc->id_numfrags))
+ if (chkrange(idesc->id_blkno, fragstodb(&sblock, idesc->id_numfrags)))
return (SKIP);
bp = getddblk(idesc->id_blkno, sblock.lfs_bsize);
ilevel--;
diff -r 5f99bc3cb900 -r 8a5c595bb561 sbin/fsck_lfs/pass1.c
--- a/sbin/fsck_lfs/pass1.c Sat Jan 06 22:50:00 2001 +0000
+++ b/sbin/fsck_lfs/pass1.c Sat Jan 06 23:08:24 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass1.c,v 1.9 2001/01/05 02:02:58 lukem Exp $ */
+/* $NetBSD: pass1.c,v 1.10 2001/01/06 23:08:26 joff Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -330,7 +330,6 @@
badblk = dupblk = 0;
idesc->id_number = inumber;
(void)ckinode(dp, idesc);
- idesc->id_entryno *= btodb(sblock.lfs_fsize);
if (dp->di_blocks != idesc->id_entryno) {
pwarn("INCORRECT BLOCK COUNT I=%u (%d should be %d)",
inumber, dp->di_blocks, idesc->id_entryno);
@@ -358,12 +357,12 @@
pass1check(struct inodesc * idesc)
{
int res = KEEPON;
- int anyout, nfrags;
+ int anyout, ndblks;
daddr_t blkno = idesc->id_blkno;
register struct dups *dlp;
struct dups *new;
- if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) {
+ if ((anyout = chkrange(blkno, fragstodb(&sblock, idesc->id_numfrags))) != 0) {
blkerror(idesc->id_number, "BAD", blkno);
if (badblk++ >= MAXBAD) {
pwarn("EXCESSIVE BAD BLKS I=%u",
@@ -377,7 +376,7 @@
} else if (!testbmap(blkno)) {
seg_table[datosn(&sblock, blkno)].su_nbytes += idesc->id_numfrags * sblock.lfs_fsize;
}
- for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
+ for (ndblks = fragstodb(&sblock, idesc->id_numfrags); ndblks > 0; blkno++, ndblks--) {
if (anyout && chkrange(blkno, 1)) {
res = SKIP;
} else if (!testbmap(blkno)) {
diff -r 5f99bc3cb900 -r 8a5c595bb561 sbin/fsck_lfs/pass4.c
--- a/sbin/fsck_lfs/pass4.c Sat Jan 06 22:50:00 2001 +0000
+++ b/sbin/fsck_lfs/pass4.c Sat Jan 06 23:08:24 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass4.c,v 1.3 2000/05/23 01:48:55 perseant Exp $ */
+/* $NetBSD: pass4.c,v 1.4 2001/01/06 23:08:29 joff Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -108,10 +108,10 @@
pass4check(struct inodesc * idesc)
{
register struct dups *dlp;
- int nfrags, res = KEEPON;
+ int ndblks, res = KEEPON;
daddr_t blkno = idesc->id_blkno;
- for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
+ for (ndblks = fragstodb(&sblock, idesc->id_numfrags); ndblks > 0; blkno++, ndblks--) {
if (chkrange(blkno, 1)) {
res = SKIP;
} else if (testbmap(blkno)) {
Home |
Main Index |
Thread Index |
Old Index