make these compilable with lfs debug options.
(follow daddr_t change) XXX maybe segment number should be 64bit.
This commit is contained in:
parent
5e14aa69a8
commit
e41d3a6f1c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs.h,v 1.43 2003/01/24 21:55:25 fvdl Exp $ */
|
||||
/* $NetBSD: lfs.h,v 1.44 2003/01/27 23:17:56 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -628,7 +628,7 @@ struct segsum {
|
|||
(fs)->lfs_ssize << (fs)->lfs_blktodb : \
|
||||
btofsb((fs), (fs)->lfs_ssize)) * (seg))
|
||||
#define dtosn(fs, daddr) /* block address to segment number */ \
|
||||
(((daddr) - (fs)->lfs_start) / segtod((fs), 1))
|
||||
((uint32_t)(((daddr) - (fs)->lfs_start) / segtod((fs), 1)))
|
||||
#define sntod(fs, sn) /* segment number to disk address */ \
|
||||
((daddr_t)(segtod((fs), (sn)) + (fs)->lfs_start))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_alloc.c,v 1.61 2003/01/25 18:12:32 tron Exp $ */
|
||||
/* $NetBSD: lfs_alloc.c,v 1.62 2003/01/27 23:17:56 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -71,7 +71,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.61 2003/01/25 18:12:32 tron Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.62 2003/01/27 23:17:56 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -589,7 +589,7 @@ lfs_vfree(void *v)
|
|||
#ifdef DIAGNOSTIC
|
||||
if (sup->su_nbytes < DINODE_SIZE) {
|
||||
printf("lfs_vfree: negative byte count"
|
||||
" (segment %" PRId64 " short by %d)\n",
|
||||
" (segment %" PRIu32 " short by %d)\n",
|
||||
dtosn(fs, old_iaddr),
|
||||
(int)DINODE_SIZE - sup->su_nbytes);
|
||||
panic("lfs_vfree: negative byte count");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_segment.c,v 1.95 2003/01/27 21:45:52 kleink Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.96 2003/01/27 23:17:57 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -71,7 +71,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.95 2003/01/27 21:45:52 kleink Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.96 2003/01/27 23:17:57 yamt Exp $");
|
||||
|
||||
#define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str))
|
||||
|
||||
|
@ -968,15 +968,14 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip)
|
|||
#ifdef DIAGNOSTIC
|
||||
if (sup->su_nbytes + DINODE_SIZE * ndupino < DINODE_SIZE) {
|
||||
printf("lfs_writeinode: negative bytes "
|
||||
"(segment %" PRId64 " short by %d, "
|
||||
"oldsn=%u, cursn=%u, daddr=%d, su_nbytes=%u, "
|
||||
"(segment %" PRIu32 " short by %d, "
|
||||
"oldsn=%" PRIu32 ", cursn=%" PRIu32
|
||||
", daddr=%" PRId64 ", su_nbytes=%u, "
|
||||
"ndupino=%d)\n",
|
||||
dtosn(fs, daddr),
|
||||
(int)DINODE_SIZE * (1 - sp->ndupino)
|
||||
- sup->su_nbytes,
|
||||
(unsigned int)oldsn,
|
||||
(unsigned int)sp->seg_number,
|
||||
(int)daddr,
|
||||
oldsn, sp->seg_number, daddr,
|
||||
(unsigned int)sup->su_nbytes,
|
||||
sp->ndupino);
|
||||
panic("lfs_writeinode: negative bytes");
|
||||
|
@ -1079,7 +1078,7 @@ loop: for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
|
|||
if ((bp->b_flags & (B_BUSY|B_GATHERED)) || !match(fs, bp)) {
|
||||
#ifdef DEBUG_LFS
|
||||
if (vp == fs->lfs_ivnode && (bp->b_flags & (B_BUSY|B_GATHERED)) == B_BUSY)
|
||||
printf("(%d:%lx)", bp->b_lblkno, bp->b_flags);
|
||||
printf("(%" PRId64 ":%lx)", bp->b_lblkno, bp->b_flags);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
@ -1290,7 +1289,7 @@ lfs_updatemeta(struct segment *sp)
|
|||
#ifdef DIAGNOSTIC
|
||||
if (sup->su_nbytes + DINODE_SIZE * ndupino < osize) {
|
||||
printf("lfs_updatemeta: negative bytes "
|
||||
"(segment %" PRId64 " short by %d)\n",
|
||||
"(segment %" PRIu32 " short by %d)\n",
|
||||
dtosn(fs, daddr),
|
||||
osize - sup->su_nbytes);
|
||||
printf("lfs_updatemeta: ino %d, lbn %" PRId64
|
||||
|
@ -1302,8 +1301,8 @@ lfs_updatemeta(struct segment *sp)
|
|||
}
|
||||
#endif
|
||||
#ifdef DEBUG_SU_NBYTES
|
||||
printf("seg %d -= %ld for ino %d lbn %" PRId64
|
||||
" db 0x%x\n",
|
||||
printf("seg %" PRIu32 " -= %d for ino %d lbn %" PRId64
|
||||
" db 0x%" PRIx64 "\n",
|
||||
dtosn(fs, daddr), osize,
|
||||
VTOI(sp->vp)->i_number, lbn, daddr);
|
||||
#endif
|
||||
|
@ -1617,10 +1616,10 @@ lfs_writeseg(struct lfs *fs, struct segment *sp)
|
|||
if ((*bpp)->b_vp != devvp) {
|
||||
sup->su_nbytes += (*bpp)->b_bcount;
|
||||
#ifdef DEBUG_SU_NBYTES
|
||||
printf("seg %d += %ld for ino %d lbn %" PRId64 " db 0x%x\n",
|
||||
sp->seg_number, (*bpp)->b_bcount,
|
||||
VTOI((*bpp)->b_vp)->i_number,
|
||||
(*bpp)->b_lblkno, (*bpp)->b_blkno);
|
||||
printf("seg %" PRIu32 " += %ld for ino %d lbn %" PRId64
|
||||
" db 0x%" PRIx64 "\n", sp->seg_number, (*bpp)->b_bcount,
|
||||
VTOI((*bpp)->b_vp)->i_number, (*bpp)->b_lblkno,
|
||||
(*bpp)->b_blkno);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1859,8 +1858,8 @@ lfs_writeseg(struct lfs *fs, struct segment *sp)
|
|||
#if defined(DEBUG) && defined(DIAGNOSTIC)
|
||||
if(dtosn(fs, dbtofsb(fs, (*bpp)->b_blkno + btodb((*bpp)->b_bcount - 1))) !=
|
||||
dtosn(fs, dbtofsb(fs, cbp->b_blkno))) {
|
||||
printf("block at %" PRIx64 " (%" PRId64 "), "
|
||||
"cbp at %" PRIx64 " (%" PRId64 ")\n",
|
||||
printf("block at %" PRId64 " (%" PRIu32 "), "
|
||||
"cbp at %" PRId64 " (%" PRIu32 ")\n",
|
||||
(*bpp)->b_blkno, dtosn(fs, dbtofsb(fs, (*bpp)->b_blkno)),
|
||||
cbp->b_blkno, dtosn(fs, dbtofsb(fs, cbp->b_blkno)));
|
||||
panic("lfs_writeseg: Segment overwrite");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_vfsops.c,v 1.88 2003/01/25 23:00:09 kleink Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.89 2003/01/27 23:17:57 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -71,7 +71,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.88 2003/01/25 23:00:09 kleink Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.89 2003/01/27 23:17:57 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -446,7 +446,7 @@ update_meta(struct lfs *fs, ino_t ino, int version, daddr_t lbn,
|
|||
#ifdef DIAGNOSTIC
|
||||
if (sup->su_nbytes < size) {
|
||||
panic("update_meta: negative bytes "
|
||||
"(segment %" PRId64 " short by %ld)\n",
|
||||
"(segment %" PRIu32 " short by %ld)\n",
|
||||
dtosn(fs, dbtofsb(fs, odaddr)), (long)size - sup->su_nbytes);
|
||||
sup->su_nbytes = size;
|
||||
}
|
||||
|
@ -465,8 +465,8 @@ update_meta(struct lfs *fs, ino_t ino, int version, daddr_t lbn,
|
|||
/* Now look again to make sure it worked */
|
||||
ufs_bmaparray(vp, lbn, &odaddr, &a[0], &num, NULL );
|
||||
if (dbtofsb(fs, odaddr) != ndaddr)
|
||||
printf("update_meta: failed setting ino %d lbn %d to %x\n",
|
||||
ino, lbn, ndaddr);
|
||||
printf("update_meta: failed setting ino %d lbn %" PRId64
|
||||
" to %" PRId64 "\n", ino, lbn, ndaddr);
|
||||
#endif
|
||||
vput(vp);
|
||||
return 0;
|
||||
|
@ -602,21 +602,21 @@ check_segsum(struct lfs *fs, daddr_t offset,
|
|||
fs->lfs_sumsize -
|
||||
sizeof(ssp->ss_sumsum))) {
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("Sumsum error at 0x%x\n", offset);
|
||||
printf("Sumsum error at 0x%" PRIx64 "\n", offset);
|
||||
#endif
|
||||
offset = -1;
|
||||
goto err1;
|
||||
}
|
||||
if (ssp->ss_nfinfo == 0 && ssp->ss_ninos == 0) {
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("Empty pseg at 0x%x\n", offset);
|
||||
printf("Empty pseg at 0x%" PRIx64 "\n", offset);
|
||||
#endif
|
||||
offset = -1;
|
||||
goto err1;
|
||||
}
|
||||
if (ssp->ss_create < fs->lfs_tstamp) {
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("Old data at 0x%x\n", offset);
|
||||
printf("Old data at 0x%" PRIx64 "\n", offset);
|
||||
#endif
|
||||
offset = -1;
|
||||
goto err1;
|
||||
|
@ -626,15 +626,16 @@ check_segsum(struct lfs *fs, daddr_t offset,
|
|||
serial = ssp->ss_serial;
|
||||
if (serial != fs->lfs_serial + 1) {
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("Unexpected serial number at 0x%x\n", offset);
|
||||
printf("Unexpected serial number at 0x%" PRIx64
|
||||
"\n", offset);
|
||||
#endif
|
||||
offset = -1;
|
||||
goto err1;
|
||||
}
|
||||
if (ssp->ss_ident != fs->lfs_ident) {
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("Incorrect fsid (0x%x vs 0x%x) at 0x%x\n",
|
||||
ssp->ss_ident, fs->lfs_ident, offset);
|
||||
printf("Incorrect fsid (0x%x vs 0x%x) at 0x%"
|
||||
PRIx64 "\n", ssp->ss_ident, fs->lfs_ident, offset);
|
||||
#endif
|
||||
offset = -1;
|
||||
goto err1;
|
||||
|
@ -731,8 +732,8 @@ check_segsum(struct lfs *fs, daddr_t offset,
|
|||
ssp->ss_datasum != cksum(datap, nblocks * sizeof(u_long)))
|
||||
{
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("Datasum error at 0x%x (wanted %x got %x)\n", offset,
|
||||
ssp->ss_datasum, cksum(datap, nblocks *
|
||||
printf("Datasum error at 0x%" PRIx64 " (wanted %x got %x)\n",
|
||||
offset, ssp->ss_datasum, cksum(datap, nblocks *
|
||||
sizeof(u_long)));
|
||||
#endif
|
||||
offset = -1;
|
||||
|
@ -748,7 +749,7 @@ check_segsum(struct lfs *fs, daddr_t offset,
|
|||
}
|
||||
offset = ssp->ss_next;
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("LFS roll forward: moving on to offset 0x%x "
|
||||
printf("LFS roll forward: moving on to offset 0x%" PRIx64
|
||||
" -> segment %d\n", offset, dtosn(fs,offset));
|
||||
#endif
|
||||
}
|
||||
|
@ -1038,8 +1039,8 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
|
|||
lastgoodpseg = oldoffset = offset = fs->lfs_offset;
|
||||
flags = 0x0;
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("LFS roll forward phase 1: starting at offset 0x%x\n",
|
||||
offset);
|
||||
printf("LFS roll forward phase 1: starting at offset 0x%"
|
||||
PRIx64 "\n", offset);
|
||||
#endif
|
||||
LFS_SEGENTRY(sup, fs, dtosn(fs, offset), bp);
|
||||
if (!(sup->su_flags & SEGUSE_DIRTY))
|
||||
|
@ -1059,14 +1060,14 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
|
|||
}
|
||||
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("LFS roll forward phase 1: offset=0x%x\n",
|
||||
offset);
|
||||
printf("LFS roll forward phase 1: offset=0x%"
|
||||
PRIx64 "\n", offset);
|
||||
if (flags & SS_DIROP) {
|
||||
printf("lfs_mountfs: dirops at 0x%x\n",
|
||||
printf("lfs_mountfs: dirops at 0x%" PRIx64 "\n",
|
||||
oldoffset);
|
||||
if (!(flags & SS_CONT))
|
||||
printf("lfs_mountfs: dirops end "
|
||||
"at 0x%x\n", oldoffset);
|
||||
"at 0x%" PRIx64 "\n", oldoffset);
|
||||
}
|
||||
#endif
|
||||
if (!(flags & SS_CONT))
|
||||
|
@ -1079,7 +1080,7 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
|
|||
"dirops discarded\n");
|
||||
}
|
||||
printf("LFS roll forward phase 1: completed: "
|
||||
"lastgoodpseg=0x%x\n", lastgoodpseg);
|
||||
"lastgoodpseg=0x%" PRIx64 "\n", lastgoodpseg);
|
||||
#endif
|
||||
oldoffset = fs->lfs_offset;
|
||||
if (fs->lfs_offset != lastgoodpseg) {
|
||||
|
@ -1104,8 +1105,8 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
|
|||
*/
|
||||
while (offset != lastgoodpseg) {
|
||||
#ifdef DEBUG_LFS_RFW
|
||||
printf("LFS roll forward phase 2: 0x%x\n",
|
||||
offset);
|
||||
printf("LFS roll forward phase 2: 0x%"
|
||||
PRIx64 "\n", offset);
|
||||
#endif
|
||||
offset = check_segsum(fs, offset, cred,
|
||||
CHECK_UPDATE, NULL, p);
|
||||
|
|
Loading…
Reference in New Issue