Use accessors in DEBUG and DIAGNOSTIC code as well
This commit is contained in:
parent
1cd8415fdc
commit
7f29db77f4
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $ */
|
/* $NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -231,7 +231,7 @@ lfs_reserveavail(struct lfs *fs, struct vnode *vp,
|
||||||
DLOG((DLOG_AVAIL, "lfs_reserve: waiting for %ld (bfree = %d,"
|
DLOG((DLOG_AVAIL, "lfs_reserve: waiting for %ld (bfree = %d,"
|
||||||
" est_bfree = %d)\n",
|
" est_bfree = %d)\n",
|
||||||
fsb + fs->lfs_ravail + fs->lfs_favail,
|
fsb + fs->lfs_ravail + fs->lfs_favail,
|
||||||
fs->lfs_bfree, LFS_EST_BFREE(fs)));
|
lfs_sb_getbfree(fs), LFS_EST_BFREE(fs)));
|
||||||
}
|
}
|
||||||
++slept;
|
++slept;
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ lfs_fits(struct lfs *fs, int fsb)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
DLOG((DLOG_AVAIL, "lfs_fits: no fit: fsb = %ld, uinodes = %ld, "
|
DLOG((DLOG_AVAIL, "lfs_fits: no fit: fsb = %ld, uinodes = %ld, "
|
||||||
"needed = %jd, avail = %jd\n",
|
"needed = %jd, avail = %jd\n",
|
||||||
(long)fsb, (long)fs->lfs_uinodes, (intmax_t)needed,
|
(long)fsb, (long)lfs_sb_getuinodes(fs), (intmax_t)needed,
|
||||||
(intmax_t)lfs_sb_getavail(fs)));
|
(intmax_t)lfs_sb_getavail(fs)));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $ */
|
/* $NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
|
@ -129,62 +129,62 @@ lfs_dump_super(struct lfs *lfsp)
|
||||||
printf("%s%x\t%s%x\t%s%d\t%s%d\n",
|
printf("%s%x\t%s%x\t%s%d\t%s%d\n",
|
||||||
"magic ", lfsp->lfs_magic,
|
"magic ", lfsp->lfs_magic,
|
||||||
"version ", lfsp->lfs_version,
|
"version ", lfsp->lfs_version,
|
||||||
"size ", lfsp->lfs_size,
|
"size ", lfs_sb_getsize(lfsp),
|
||||||
"ssize ", lfsp->lfs_ssize);
|
"ssize ", lfs_sb_getssize(lfsp));
|
||||||
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
||||||
"dsize ", lfsp->lfs_dsize,
|
"dsize ", lfs_sb_getdsize(lfsp),
|
||||||
"bsize ", lfsp->lfs_bsize,
|
"bsize ", lfs_sb_getbsize(lfsp),
|
||||||
"fsize ", lfsp->lfs_fsize,
|
"fsize ", lfs_sb_getfsize(lfsp),
|
||||||
"frag ", lfsp->lfs_frag);
|
"frag ", lfs_sb_getfrag(lfsp));
|
||||||
|
|
||||||
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
||||||
"minfree ", lfsp->lfs_minfree,
|
"minfree ", lfs_sb_getminfree(lfsp),
|
||||||
"inopb ", lfsp->lfs_inopb,
|
"inopb ", lfs_sb_getinopb(lfsp),
|
||||||
"ifpb ", lfsp->lfs_ifpb,
|
"ifpb ", lfs_sb_getifpb(lfsp),
|
||||||
"nindir ", lfsp->lfs_nindir);
|
"nindir ", lfs_sb_getnindir(lfsp));
|
||||||
|
|
||||||
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
||||||
"nseg ", lfsp->lfs_nseg,
|
"nseg ", lfs_sb_getnseg(lfsp),
|
||||||
"nspf ", lfsp->lfs_nspf,
|
"nspf ", lfs_sb_getnspf(lfsp),
|
||||||
"cleansz ", lfsp->lfs_cleansz,
|
"cleansz ", lfs_sb_getcleansz(lfsp),
|
||||||
"segtabsz ", lfsp->lfs_segtabsz);
|
"segtabsz ", lfs_sb_getsegtabsz(lfsp));
|
||||||
|
|
||||||
printf("%s%x\t%s%d\t%s%lx\t%s%d\n",
|
printf("%s%x\t%s%d\t%s%lx\t%s%d\n",
|
||||||
"segmask ", lfsp->lfs_segmask,
|
"segmask ", lfs_sb_getsegmask(lfsp),
|
||||||
"segshift ", lfsp->lfs_segshift,
|
"segshift ", lfs_sb_getsegshift(lfsp),
|
||||||
"bmask ", (unsigned long)lfsp->lfs_bmask,
|
"bmask ", (unsigned long)lfs_sb_getbmask(lfsp),
|
||||||
"bshift ", lfsp->lfs_bshift);
|
"bshift ", lfs_sb_getbshift(lfsp));
|
||||||
|
|
||||||
printf("%s%lu\t%s%d\t%s%lx\t%s%u\n",
|
printf("%s%lu\t%s%d\t%s%lx\t%s%u\n",
|
||||||
"ffmask ", (unsigned long)lfsp->lfs_ffmask,
|
"ffmask ", (unsigned long)lfs_sb_getffmask(lfsp),
|
||||||
"ffshift ", lfsp->lfs_ffshift,
|
"ffshift ", lfs_sb_getffshift(lfsp),
|
||||||
"fbmask ", (unsigned long)lfsp->lfs_fbmask,
|
"fbmask ", (unsigned long)lfs_sb_getfbmask(lfsp),
|
||||||
"fbshift ", lfsp->lfs_fbshift);
|
"fbshift ", lfs_sb_getfbshift(lfsp));
|
||||||
|
|
||||||
printf("%s%d\t%s%d\t%s%x\t%s%qx\n",
|
printf("%s%d\t%s%d\t%s%x\t%s%qx\n",
|
||||||
"sushift ", lfsp->lfs_sushift,
|
"sushift ", lfs_sb_getsushift(lfsp),
|
||||||
"fsbtodb ", lfsp->lfs_fsbtodb,
|
"fsbtodb ", lfs_sb_getfsbtodb(lfsp),
|
||||||
"cksum ", lfsp->lfs_cksum,
|
"cksum ", lfs_sb_getcksum(lfsp),
|
||||||
"maxfilesize ", (long long)lfsp->lfs_maxfilesize);
|
"maxfilesize ", (long long)lfs_sb_getmaxfilesize(lfsp));
|
||||||
|
|
||||||
printf("Superblock disk addresses:");
|
printf("Superblock disk addresses:");
|
||||||
for (i = 0; i < LFS_MAXNUMSB; i++)
|
for (i = 0; i < LFS_MAXNUMSB; i++)
|
||||||
printf(" %x", lfsp->lfs_sboffs[i]);
|
printf(" %x", lfs_sb_getsboff(lfsp, i));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Checkpoint Info\n");
|
printf("Checkpoint Info\n");
|
||||||
printf("%s%d\t%s%x\t%s%d\n",
|
printf("%s%d\t%s%x\t%s%d\n",
|
||||||
"freehd ", lfsp->lfs_freehd,
|
"freehd ", lfs_sb_getfreehd(lfsp),
|
||||||
"idaddr ", lfsp->lfs_idaddr,
|
"idaddr ", lfs_sb_getidaddr(lfsp),
|
||||||
"ifile ", lfsp->lfs_ifile);
|
"ifile ", lfs_sb_getifile(lfsp));
|
||||||
printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n",
|
printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n",
|
||||||
"bfree ", lfsp->lfs_bfree,
|
"bfree ", lfs_sb_getbfree(lfsp),
|
||||||
"nfiles ", lfsp->lfs_nfiles,
|
"nfiles ", lfs_sb_getnfiles(lfsp),
|
||||||
"lastseg ", lfsp->lfs_lastseg,
|
"lastseg ", lfs_sb_getlastseg(lfsp),
|
||||||
"nextseg ", lfsp->lfs_nextseg,
|
"nextseg ", lfs_sb_getnextseg(lfsp),
|
||||||
"curseg ", lfsp->lfs_curseg,
|
"curseg ", lfs_sb_getcurseg(lfsp),
|
||||||
"offset ", lfsp->lfs_offset);
|
"offset ", lfs_sb_getoffset(lfsp));
|
||||||
printf("tstamp %llx\n", (long long)lfsp->lfs_tstamp);
|
printf("tstamp %llx\n", (long long)lfs_sb_gettstamp(lfsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -232,11 +232,11 @@ lfs_check_segsum(struct lfs *fs, struct segment *sp, char *file, int line)
|
||||||
|
|
||||||
if (sp->sum_bytes_left > 484) {
|
if (sp->sum_bytes_left > 484) {
|
||||||
printf("%s:%d: bad value (%d = -%d) for sum_bytes_left\n",
|
printf("%s:%d: bad value (%d = -%d) for sum_bytes_left\n",
|
||||||
file, line, sp->sum_bytes_left, fs->lfs_sumsize-sp->sum_bytes_left);
|
file, line, sp->sum_bytes_left, lfs_sb_getsumsize(fs)-sp->sum_bytes_left);
|
||||||
panic("too many bytes");
|
panic("too many bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
actual = fs->lfs_sumsize
|
actual = lfs_sb_getsumsize(fs)
|
||||||
/* amount taken up by FINFOs */
|
/* amount taken up by FINFOs */
|
||||||
- ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum))
|
- ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum))
|
||||||
/* amount taken up by inode blocks */
|
/* amount taken up by inode blocks */
|
||||||
|
@ -258,12 +258,12 @@ lfs_check_segsum(struct lfs *fs, struct segment *sp, char *file, int line)
|
||||||
actual);
|
actual);
|
||||||
#endif
|
#endif
|
||||||
if (sp->sum_bytes_left > 0
|
if (sp->sum_bytes_left > 0
|
||||||
&& ((char *)(sp->segsum))[fs->lfs_sumsize
|
&& ((char *)(sp->segsum))[lfs_sb_getsumsize(fs)
|
||||||
- sizeof(int32_t) * ((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs))
|
- sizeof(int32_t) * ((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs))
|
||||||
- sp->sum_bytes_left] != '\0') {
|
- sp->sum_bytes_left] != '\0') {
|
||||||
printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n",
|
printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n",
|
||||||
file, line, sp->sum_bytes_left,
|
file, line, sp->sum_bytes_left,
|
||||||
fs->lfs_sumsize-sp->sum_bytes_left,
|
lfs_sb_getsumsize(fs)-sp->sum_bytes_left,
|
||||||
actual);
|
actual);
|
||||||
#ifdef DDB
|
#ifdef DDB
|
||||||
Debugger();
|
Debugger();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: lfs_pages.c,v 1.3 2015/07/24 06:59:32 dholland Exp $ */
|
/* $NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.3 2015/07/24 06:59:32 dholland Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_compat_netbsd.h"
|
#include "opt_compat_netbsd.h"
|
||||||
|
@ -784,8 +784,8 @@ lfs_putpages(void *v)
|
||||||
if (error == EDEADLK || error == EAGAIN) {
|
if (error == EDEADLK || error == EAGAIN) {
|
||||||
DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
|
DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
|
||||||
" %d ino %d off %x (seg %d)\n", error,
|
" %d ino %d off %x (seg %d)\n", error,
|
||||||
ip->i_number, fs->lfs_offset,
|
ip->i_number, lfs_sb_getoffset(fs),
|
||||||
lfs_dtosn(fs, fs->lfs_offset)));
|
lfs_dtosn(fs, lfs_sb_getoffset(fs))));
|
||||||
|
|
||||||
if (oreclaim) {
|
if (oreclaim) {
|
||||||
mutex_enter(vp->v_interlock);
|
mutex_enter(vp->v_interlock);
|
||||||
|
@ -799,8 +799,8 @@ lfs_putpages(void *v)
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
|
DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
|
||||||
" %d ino %d off %x (seg %d)\n", error,
|
" %d ino %d off %x (seg %d)\n", error,
|
||||||
(int)ip->i_number, fs->lfs_offset,
|
(int)ip->i_number, lfs_sb_getoffset(fs),
|
||||||
lfs_dtosn(fs, fs->lfs_offset)));
|
lfs_dtosn(fs, lfs_sb_getoffset(fs))));
|
||||||
}
|
}
|
||||||
/* genfs_do_putpages loses the interlock */
|
/* genfs_do_putpages loses the interlock */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: lfs_segment.c,v 1.243 2015/07/24 06:59:32 dholland Exp $ */
|
/* $NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.243 2015/07/24 06:59:32 dholland Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $");
|
||||||
|
|
||||||
#define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */
|
#define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */
|
||||||
|
|
||||||
|
@ -2247,7 +2247,7 @@ lfs_writeseg(struct lfs *fs, struct segment *sp)
|
||||||
/ sizeof(int32_t)) {
|
/ sizeof(int32_t)) {
|
||||||
panic("lfs_writeseg: real bpp overwrite");
|
panic("lfs_writeseg: real bpp overwrite");
|
||||||
}
|
}
|
||||||
if (bpp - sp->bpp > lfs_segsize(fs) / fs->lfs_fsize) {
|
if (bpp - sp->bpp > lfs_segsize(fs) / lfs_sb_getfsize(fs)) {
|
||||||
panic("lfs_writeseg: theoretical bpp overwrite");
|
panic("lfs_writeseg: theoretical bpp overwrite");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: lfs_vnops.c,v 1.275 2015/07/24 06:59:32 dholland Exp $ */
|
/* $NetBSD: lfs_vnops.c,v 1.276 2015/07/25 10:40:35 martin Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.275 2015/07/24 06:59:32 dholland Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.276 2015/07/25 10:40:35 martin Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_compat_netbsd.h"
|
#include "opt_compat_netbsd.h"
|
||||||
|
@ -1870,7 +1870,7 @@ segwait_common:
|
||||||
LFS_CLEANERINFO(cip, fs, bp);
|
LFS_CLEANERINFO(cip, fs, bp);
|
||||||
DLOG((DLOG_CLEAN, "lfs_fcntl: reclaim wrote %" PRId64
|
DLOG((DLOG_CLEAN, "lfs_fcntl: reclaim wrote %" PRId64
|
||||||
" blocks, cleaned %" PRId32 " segments (activesb %d)\n",
|
" blocks, cleaned %" PRId32 " segments (activesb %d)\n",
|
||||||
fs->lfs_offset - off, cip->clean - oclean,
|
lfs_sb_getoffset(fs) - off, cip->clean - oclean,
|
||||||
fs->lfs_activesb));
|
fs->lfs_activesb));
|
||||||
LFS_SYNC_CLEANERINFO(cip, fs, bp, 0);
|
LFS_SYNC_CLEANERINFO(cip, fs, bp, 0);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue