Change lfs_sb_cksum to use offsetof() instead of an inlined version.

Fix lfs_vref/lfs_vunredf to ignore VXLOCKed vnodes that are also being
flushed.

Improve the debugging messages somewhat.
This commit is contained in:
perseant 1999-03-25 21:54:10 +00:00
parent e6ef2d67dd
commit 1cacaa295f
3 changed files with 36 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_cksum.c,v 1.10 1999/03/10 00:20:00 perseant Exp $ */
/* $NetBSD: lfs_cksum.c,v 1.11 1999/03/25 21:54:10 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -73,8 +73,10 @@
#include <sys/types.h>
#include <sys/param.h>
#ifdef _KERNEL
#include <sys/systm.h>
#include <sys/lock.h>
# include <sys/systm.h>
# include <sys/lock.h>
#else
# include <stddef.h>
#endif
#include <sys/mount.h>
#include <ufs/ufs/quota.h>
@ -110,6 +112,6 @@ lfs_sb_cksum(fs)
{
size_t size;
size = (size_t)&(((struct dlfs *)0)->dlfs_cksum);
size = (size_t)offsetof(struct dlfs, dlfs_cksum);
return cksum(fs,size);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.16 1999/03/25 21:39:18 perseant Exp $ */
/* $NetBSD: lfs_segment.c,v 1.17 1999/03/25 21:54:10 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -872,6 +872,9 @@ lfs_updatemeta(sp)
lbn = *sp->start_lbp++;
(*sp->start_bpp)->b_blkno = off = fs->lfs_offset;
if((*sp->start_bpp)->b_blkno == (*sp->start_bpp)->b_lblkno) {
printf("lfs_updatemeta: ino %d blk %d has same lbn and daddr\n", VTOI(vp)->i_number, off);
}
fs->lfs_offset +=
fragstodb(fs, numfrags(fs, (*sp->start_bpp)->b_bcount));
@ -1160,6 +1163,12 @@ lfs_writeseg(fs, sp)
cbp->b_flags |= B_ASYNC | B_BUSY;
cbp->b_bcount = 0;
#ifdef DIAGNOSTIC
if(datosn(fs,(*bpp)->b_blkno + ((*bpp)->b_bcount - 1)/DEV_BSIZE) != datosn(fs,cbp->b_blkno)) {
panic("lfs_writeseg: Segment overwrite");
}
#endif
if(fs->lfs_iocount >= LFS_THROTTLE) {
tsleep(&fs->lfs_iocount, PRIBIO+1, "lfs throttle", 0);
}
@ -1460,7 +1469,6 @@ lfs_vref(vp)
*/
if (vp->v_flag & VXLOCK) {
if(IS_FLUSHING(VTOI(vp)->i_lfs,vp)) {
vp->v_usecount++;
return 0;
}
return(1);
@ -1476,9 +1484,18 @@ void
lfs_vunref(vp)
register struct vnode *vp;
{
/*
* Analogous to lfs_vref, if the node is flushing, fake it.
*/
if((vp->v_flag & VXLOCK) && IS_FLUSHING(VTOI(vp)->i_lfs,vp)) {
return;
}
simple_lock(&vp->v_interlock);
#ifdef DIAGNOSTIC
if(vp->v_usecount==0) {
if(vp->v_usecount<=0) {
printf("lfs_vunref: flags are 0x%lx\n", vp->v_flag);
printf("lfs_vunref: usecount = %d\n", vp->v_usecount);
panic("lfs_vunref: v_usecount<0");
}
#endif
@ -1487,14 +1504,6 @@ lfs_vunref(vp)
simple_unlock(&vp->v_interlock);
return;
}
/*
* We also don't want to vrele() here during a flush, since
* that will be done again later, causing us serious problems.
*/
if(IS_FLUSHING(VTOI(vp)->i_lfs,vp)) {
simple_unlock(&vp->v_interlock);
return;
}
/*
* insert at tail of LRU list

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.23 1999/03/25 21:39:18 perseant Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.24 1999/03/25 21:54:10 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -631,7 +631,7 @@ lfs_bmapv(p, v, retval)
* here. Instead, we try an unlocked access.
*/
vp = ufs_ihashlookup(ump->um_dev, blkp->bi_inode);
if (vp != NULL) {
if (vp != NULL && !(vp->v_flag & VXLOCK)) {
ip = VTOI(vp);
if(VOP_ISLOCKED(vp)) {
/* printf("inode %d inlocked in bmapv\n",ip->i_number); */
@ -648,6 +648,9 @@ lfs_bmapv(p, v, retval)
if(error) {
v_daddr = LFS_UNUSED_DADDR;
need_unlock = 0;
#ifdef DEBUG_LFS
printf("lfs_bmapv: vget of ino %d failed with %d)",blkp->bi_inode,error);
#endif
continue;
} else {
need_unlock = FVG_PUT;
@ -901,10 +904,12 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
if ((*vpp = ufs_ihashlookup(dev, ino)) != NULL) {
lfs_vref(*vpp);
if ((*vpp)->v_flag & VXLOCK) {
/* printf("vnode VXLOCKed\n"); */
printf("vnode VXLOCKed for ino %d\n",ino);
clean_vnlocked++;
#ifdef LFS_EAGAIN_FAIL
#if 0 /* XXXX KS */
lfs_vunref(*vpp);
#endif
return EAGAIN;
#endif
}
@ -959,6 +964,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
if (dinp) {
error = copyin(dinp, &ip->i_din.ffs_din, DINODE_SIZE);
if (error) {
printf("lfs_fastvget: dinode copyin failed for ino %d\n", ino);
ufs_ihashrem(ip);
/* Unlock and discard unneeded inode. */
@ -997,6 +1003,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
*/
error = ufs_vinit(mp, lfs_specop_p, lfs_fifoop_p, &vp);
if (error) {
printf("ufs_vinit returned %d for ino %d\n", error, ino);
lfs_vunref(vp);
*vpp = NULL;
return (error);