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.
|
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||||
* All rights reserved.
|
* 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
|
* If that is the case mark it UNWRITTEN to
|
||||||
* keep the accounting straight.
|
* keep the accounting straight.
|
||||||
*/
|
*/
|
||||||
/* XXX ondisk32 */
|
if (lfs_iblock_get(fs, ibp->b_data,
|
||||||
if (((int32_t *)ibp->b_data)[indirs[i].in_off] == 0)
|
indirs[i].in_off) == 0)
|
||||||
((int32_t *)ibp->b_data)[indirs[i].in_off] =
|
lfs_iblock_set(fs, ibp->b_data,
|
||||||
UNWRITTEN;
|
indirs[i].in_off, UNWRITTEN);
|
||||||
/* XXX ondisk32 */
|
idaddr = lfs_iblock_get(fs, ibp->b_data,
|
||||||
idaddr = ((int32_t *)ibp->b_data)[indirs[i].in_off];
|
indirs[i].in_off);
|
||||||
if ((error = VOP_BWRITE(ibp)))
|
if ((error = VOP_BWRITE(ibp)))
|
||||||
return error;
|
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))
|
if (bread(vp, idp->in_lbn, lfs_sb_getbsize(fs), 0, &ibp))
|
||||||
panic("lfs_balloc: bread bno %lld",
|
panic("lfs_balloc: bread bno %lld",
|
||||||
(long long)idp->in_lbn);
|
(long long)idp->in_lbn);
|
||||||
/* XXX ondisk32 */
|
|
||||||
lfs_iblock_set(fs, ibp->b_data, idp->in_off,
|
lfs_iblock_set(fs, ibp->b_data, idp->in_off,
|
||||||
UNWRITTEN);
|
UNWRITTEN);
|
||||||
VOP_BWRITE(ibp);
|
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.
|
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||||
@ -547,7 +547,7 @@ void
|
|||||||
pass6(void)
|
pass6(void)
|
||||||
{
|
{
|
||||||
daddr_t daddr, ibdaddr, odaddr, lastgood;
|
daddr_t daddr, ibdaddr, odaddr, lastgood;
|
||||||
uint32_t *idaddrp; /* XXX ondisk32 */
|
IINFO *iip;
|
||||||
struct uvnode *vp, *devvp;
|
struct uvnode *vp, *devvp;
|
||||||
CLEANERINFO *cip;
|
CLEANERINFO *cip;
|
||||||
SEGUSE *sup;
|
SEGUSE *sup;
|
||||||
@ -649,13 +649,13 @@ pass6(void)
|
|||||||
LFS_INOPB(fs)) *
|
LFS_INOPB(fs)) *
|
||||||
lfs_sb_getibsize(fs)));
|
lfs_sb_getibsize(fs)));
|
||||||
}
|
}
|
||||||
// XXX ondisk32
|
iip = SEGSUM_IINFOSTART(fs, bp->b_data);
|
||||||
idaddrp = ((uint32_t *)((char *)bp->b_data + lfs_sb_getsumsize(fs)));
|
|
||||||
for (i = 0; i < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)); i++) {
|
for (i = 0; i < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)); i++) {
|
||||||
ino_t *inums;
|
ino_t *inums;
|
||||||
|
|
||||||
inums = ecalloc(LFS_INOPB(fs) + 1, sizeof(*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)));
|
lfs_sb_subbfree(fs, lfs_btofsb(fs, lfs_sb_getibsize(fs)));
|
||||||
sbdirty();
|
sbdirty();
|
||||||
bread(devvp, LFS_FSBTODB(fs, ibdaddr),
|
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.
|
* 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 nptr; /* number of block pointers per block */
|
||||||
uint64_t maxblock;
|
uint64_t maxblock;
|
||||||
|
|
||||||
/* XXX ondisk32 */
|
nptr = (1 << bshift) / LFS_BLKPTRSIZE(fs);
|
||||||
nptr = (1 << bshift) / sizeof(uint32_t);
|
|
||||||
maxblock = ULFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
maxblock = ULFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
||||||
|
|
||||||
return maxblock << bshift;
|
return maxblock << bshift;
|
||||||
|
Loading…
Reference in New Issue
Block a user