Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Change lfs_sb_cksum to use offsetof() instead of...
details: https://anonhg.NetBSD.org/src/rev/6f8ea0b33831
branches: trunk
changeset: 467547:6f8ea0b33831
user: perseant <perseant%NetBSD.org@localhost>
date: Thu Mar 25 21:54:10 1999 +0000
description:
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.
diffstat:
sys/ufs/lfs/lfs_cksum.c | 10 ++++++----
sys/ufs/lfs/lfs_segment.c | 31 ++++++++++++++++++++-----------
sys/ufs/lfs/lfs_syscalls.c | 13 ++++++++++---
3 files changed, 36 insertions(+), 18 deletions(-)
diffs (163 lines):
diff -r 260042a354c7 -r 6f8ea0b33831 sys/ufs/lfs/lfs_cksum.c
--- a/sys/ufs/lfs/lfs_cksum.c Thu Mar 25 21:39:18 1999 +0000
+++ b/sys/ufs/lfs/lfs_cksum.c Thu Mar 25 21:54:10 1999 +0000
@@ -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 @@
{
size_t size;
- size = (size_t)&(((struct dlfs *)0)->dlfs_cksum);
+ size = (size_t)offsetof(struct dlfs, dlfs_cksum);
return cksum(fs,size);
}
diff -r 260042a354c7 -r 6f8ea0b33831 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Thu Mar 25 21:39:18 1999 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Thu Mar 25 21:54:10 1999 +0000
@@ -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 @@
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 @@
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 @@
*/
if (vp->v_flag & VXLOCK) {
if(IS_FLUSHING(VTOI(vp)->i_lfs,vp)) {
- vp->v_usecount++;
return 0;
}
return(1);
@@ -1476,9 +1484,18 @@
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 @@
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
diff -r 260042a354c7 -r 6f8ea0b33831 sys/ufs/lfs/lfs_syscalls.c
--- a/sys/ufs/lfs/lfs_syscalls.c Thu Mar 25 21:39:18 1999 +0000
+++ b/sys/ufs/lfs/lfs_syscalls.c Thu Mar 25 21:54:10 1999 +0000
@@ -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 @@
* 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 @@
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 @@
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 @@
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 @@
*/
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);
Home |
Main Index |
Thread Index |
Old Index