Fix hardwired 32-bit stuff in fsck:
- compute the maximum file size using LFS_BLKPTRSIZE() - use the new IINFO in pass 6 instead of uint32_t pointers - use accessors to read and write indirect blocks
This commit is contained in:
parent
b82b54bc04
commit
db7a6054ae
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs.c,v 1.64 2015/10/03 08:28:46 dholland Exp $ */
|
||||
/* $NetBSD: lfs.c,v 1.65 2015/10/03 08:29:21 dholland Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -1137,12 +1137,12 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
||||
* If that is the case mark it UNWRITTEN to
|
||||
* keep the accounting straight.
|
||||
*/
|
||||
/* XXX ondisk32 */
|
||||
if (((int32_t *)ibp->b_data)[indirs[i].in_off] == 0)
|
||||
((int32_t *)ibp->b_data)[indirs[i].in_off] =
|
||||
UNWRITTEN;
|
||||
/* XXX ondisk32 */
|
||||
idaddr = ((int32_t *)ibp->b_data)[indirs[i].in_off];
|
||||
if (lfs_iblock_get(fs, ibp->b_data,
|
||||
indirs[i].in_off) == 0)
|
||||
lfs_iblock_set(fs, ibp->b_data,
|
||||
indirs[i].in_off, UNWRITTEN);
|
||||
idaddr = lfs_iblock_get(fs, ibp->b_data,
|
||||
indirs[i].in_off);
|
||||
if ((error = VOP_BWRITE(ibp)))
|
||||
return error;
|
||||
}
|
||||
@ -1183,7 +1183,6 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
||||
if (bread(vp, idp->in_lbn, lfs_sb_getbsize(fs), 0, &ibp))
|
||||
panic("lfs_balloc: bread bno %lld",
|
||||
(long long)idp->in_lbn);
|
||||
/* XXX ondisk32 */
|
||||
lfs_iblock_set(fs, ibp->b_data, idp->in_off,
|
||||
UNWRITTEN);
|
||||
VOP_BWRITE(ibp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass6.c,v 1.48 2015/09/01 06:15:02 dholland Exp $ */
|
||||
/* $NetBSD: pass6.c,v 1.49 2015/10/03 08:29:21 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -547,7 +547,7 @@ void
|
||||
pass6(void)
|
||||
{
|
||||
daddr_t daddr, ibdaddr, odaddr, lastgood;
|
||||
uint32_t *idaddrp; /* XXX ondisk32 */
|
||||
IINFO *iip;
|
||||
struct uvnode *vp, *devvp;
|
||||
CLEANERINFO *cip;
|
||||
SEGUSE *sup;
|
||||
@ -649,13 +649,13 @@ pass6(void)
|
||||
LFS_INOPB(fs)) *
|
||||
lfs_sb_getibsize(fs)));
|
||||
}
|
||||
// XXX ondisk32
|
||||
idaddrp = ((uint32_t *)((char *)bp->b_data + lfs_sb_getsumsize(fs)));
|
||||
iip = SEGSUM_IINFOSTART(fs, bp->b_data);
|
||||
for (i = 0; i < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)); i++) {
|
||||
ino_t *inums;
|
||||
|
||||
inums = ecalloc(LFS_INOPB(fs) + 1, sizeof(*inums));
|
||||
ibdaddr = *--idaddrp;
|
||||
ibdaddr = lfs_ii_getblock(fs, iip);
|
||||
iip = NEXTLOWER_IINFO(fs, iip);
|
||||
lfs_sb_subbfree(fs, lfs_btofsb(fs, lfs_sb_getibsize(fs)));
|
||||
sbdirty();
|
||||
bread(devvp, LFS_FSBTODB(fs, ibdaddr),
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.59 2015/09/01 06:15:02 dholland Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.60 2015/10/03 08:29:21 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -123,8 +123,7 @@ calcmaxfilesize(unsigned bshift)
|
||||
uint64_t nptr; /* number of block pointers per block */
|
||||
uint64_t maxblock;
|
||||
|
||||
/* XXX ondisk32 */
|
||||
nptr = (1 << bshift) / sizeof(uint32_t);
|
||||
nptr = (1 << bshift) / LFS_BLKPTRSIZE(fs);
|
||||
maxblock = ULFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
||||
|
||||
return maxblock << bshift;
|
||||
|
Loading…
Reference in New Issue
Block a user