From d53fc3db616522c41d9a8b98f122f5c03c71f70e Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Wed, 8 Jun 1988 01:52:04 -0800 Subject: [PATCH 1/1] must be sure to always convert b_bno to disk block (db) units SCCS-vsn: sbin/fsck/utilities.c 5.13 --- usr/src/sbin/fsck/utilities.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr/src/sbin/fsck/utilities.c b/usr/src/sbin/fsck/utilities.c index 30520333d3..c61a69a021 100644 --- a/usr/src/sbin/fsck/utilities.c +++ b/usr/src/sbin/fsck/utilities.c @@ -131,7 +131,7 @@ getdatablk(blkno, size) register BUFAREA *bp; for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next) - if (bp->b_bno == blkno) + if (bp->b_bno == fsbtodb(&sblock, blkno)) goto foundit; for (bp = bufhead.b_prev; bp != &bufhead; bp = bp->b_prev) if ((bp->b_flags & B_INUSE) == 0) @@ -162,12 +162,13 @@ getblk(bp, blk, size) daddr_t dblk; fcp = &dfile; - if (bp->b_bno == blk) + dblk = fsbtodb(&sblock, blk); + if (bp->b_bno == dblk) return (bp); flush(fcp, bp); diskreads++; - bp->b_errs = bread(fcp, bp->b_un.b_buf, fsbtodb(&sblock, blk), size); - bp->b_bno = blk; + bp->b_errs = bread(fcp, bp->b_un.b_buf, dblk, size); + bp->b_bno = dblk; bp->b_size = size; return (bp); } -- 2.20.1