add debug code to lfs_free.
This commit is contained in:
parent
81dc935e33
commit
5f444770aa
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: lfs_subr.c,v 1.31 2003/02/17 23:48:20 perseant Exp $ */
|
/* $NetBSD: lfs_subr.c,v 1.32 2003/02/19 12:58:53 yamt Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||||
@ -71,7 +71,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.31 2003/02/17 23:48:20 perseant Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.32 2003/02/19 12:58:53 yamt Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -270,11 +270,15 @@ lfs_free(struct lfs *fs, void *p, int type)
|
|||||||
int s;
|
int s;
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
res_t *re;
|
res_t *re;
|
||||||
|
#ifdef DEBUG
|
||||||
|
int i;
|
||||||
|
#endif
|
||||||
|
|
||||||
h = lfs_mhash(p);
|
h = lfs_mhash(p);
|
||||||
s = splbio();
|
s = splbio();
|
||||||
LIST_FOREACH(re, &fs->lfs_reshash[h], res) {
|
LIST_FOREACH(re, &fs->lfs_reshash[h], res) {
|
||||||
if (re->p == p) {
|
if (re->p == p) {
|
||||||
|
KASSERT(re->inuse == 1);
|
||||||
LIST_REMOVE(re, res);
|
LIST_REMOVE(re, res);
|
||||||
re->inuse = 0;
|
re->inuse = 0;
|
||||||
wakeup(&fs->lfs_resblk);
|
wakeup(&fs->lfs_resblk);
|
||||||
@ -282,6 +286,12 @@ lfs_free(struct lfs *fs, void *p, int type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
for (i = 0; i < LFS_N_TOTAL; i++) {
|
||||||
|
if (fs->lfs_resblk[i].p == p)
|
||||||
|
panic("lfs_free: inconsist reserved block");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
splx(s);
|
splx(s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user