Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck_lfs Fix hardwired 32-bit stuff in fsck:
details: https://anonhg.NetBSD.org/src/rev/afa43437a18e
branches: trunk
changeset: 340817:afa43437a18e
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Oct 03 08:29:21 2015 +0000
description:
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
diffstat:
sbin/fsck_lfs/lfs.c | 15 +++++++--------
sbin/fsck_lfs/pass6.c | 10 +++++-----
sbin/fsck_lfs/setup.c | 5 ++---
3 files changed, 14 insertions(+), 16 deletions(-)
diffs (90 lines):
diff -r 959daa88ce4c -r afa43437a18e sbin/fsck_lfs/lfs.c
--- a/sbin/fsck_lfs/lfs.c Sat Oct 03 08:29:06 2015 +0000
+++ b/sbin/fsck_lfs/lfs.c Sat Oct 03 08:29:21 2015 +0000
@@ -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 @@
* 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 @@
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);
diff -r 959daa88ce4c -r afa43437a18e sbin/fsck_lfs/pass6.c
--- a/sbin/fsck_lfs/pass6.c Sat Oct 03 08:29:06 2015 +0000
+++ b/sbin/fsck_lfs/pass6.c Sat Oct 03 08:29:21 2015 +0000
@@ -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 @@
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 @@
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),
diff -r 959daa88ce4c -r afa43437a18e sbin/fsck_lfs/setup.c
--- a/sbin/fsck_lfs/setup.c Sat Oct 03 08:29:06 2015 +0000
+++ b/sbin/fsck_lfs/setup.c Sat Oct 03 08:29:21 2015 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index