Arla-0.29pre5 and xfs_node caching under FreeBSD-3.3

Bjoern Groenvall bg at sics.se
Thu Dec 9 14:28:45 CET 1999



It turns out that in arla-0.29pre5 xfs_node caching is effectively
turned off. I've made some changes that that reenables caching. This
makes the time from running ls -R on a cached file hierarchy go down
from 0.7s to 0.01s. The file hierarchy consists of 58 directories and
992 files.

Cheers,
Björn

diff -uwr arla-0.29pre5/xfs/bsd/xfs/xfs_vnodeops.h arla-0.29pre5.hack/xfs/bsd/xfs/xfs_vnodeops.h
--- arla-0.29pre5/xfs/bsd/xfs/xfs_vnodeops.h	Mon Nov 15 11:38:01 1999
+++ arla-0.29pre5.hack/xfs/bsd/xfs/xfs_vnodeops.h	Mon Dec  6 17:55:12 1999
@@ -200,10 +200,10 @@
 xfs_reclaim_common(struct vnode *vp);
 
 int
-xfs_eopnotsupp (void *);
+xfs_eopnotsupp(struct vop_generic_args *ap);
 
 int
-xfs_returnzero (void *v);
+xfs_returnzero(struct vop_generic_args *ap);
 
 void
 xfs_printnode_common (struct vnode *vp);
diff -uwr arla-0.29pre5/xfs/bsd/xfs_message.c arla-0.29pre5.hack/xfs/bsd/xfs_message.c
--- arla-0.29pre5/xfs/bsd/xfs_message.c	Wed Dec  1 06:56:55 1999
+++ arla-0.29pre5.hack/xfs/bsd/xfs_message.c	Thu Dec  9 14:15:33 1999
@@ -259,7 +259,11 @@
 
     t = xfs_node_find(&xfs[fd], &message->handle);
     if (t != 0) {
-	/* XXX Really need to put back dirty data first. */
+        struct vnode *vp = XNODE_TO_VNODE(t);
+        /* If open for writing, return immediately. Last close:er wins! */
+	if (vp->v_usecount >= 0 && vp->v_writecount >= 1)
+            return 0;
+
 	if (DATA_FROM_XNODE(t)) {
 	    vrele(DATA_FROM_XNODE(t));
 	    DATA_FROM_XNODE(t) = (struct vnode *) 0;
@@ -267,7 +271,13 @@
 	XFS_TOKEN_CLEAR(t, ~0,
 			XFS_OPEN_MASK | XFS_ATTR_MASK |
 			XFS_DATA_MASK | XFS_LOCK_MASK);
-	cache_purge(XNODE_TO_VNODE(t));
+	/* Dir changed, must invalidate DNLC. */
+	if (vp->v_type == VDIR)
+	    xfs_dnlc_purge(vp);
+	if (vp->v_usecount == 0) {
+	    XFSDEB(XDEBVNOPS, ("xfs_message_invalidnode: vrecycle\n"));
+	    vrecycle(vp, 0, p);
+	}
     } else {
 	printf("XFS PANIC WARNING! xfs_message_invalidnode: no node!\n");
 	error = ENOENT;
diff -uwr arla-0.29pre5/xfs/bsd/xfs_vnodeops-bsd.c arla-0.29pre5.hack/xfs/bsd/xfs_vnodeops-bsd.c
--- arla-0.29pre5/xfs/bsd/xfs_vnodeops-bsd.c	Mon Nov 22 03:21:00 1999
+++ arla-0.29pre5.hack/xfs/bsd/xfs_vnodeops-bsd.c	Mon Dec  6 17:53:31 1999
@@ -965,16 +965,16 @@
 vop_t **xfs_vnodeop_p;
 
 int
-xfs_eopnotsupp (void *v)
+xfs_eopnotsupp(struct vop_generic_args *ap)
 {
-    XFSDEB(XDEBVNOPS, ("xfs_eopnotsupp\n"));
+    XFSDEB(XDEBVNOPS, ("xfs_eopnotsupp %s\n", ap->a_desc->vdesc_name));
     return EOPNOTSUPP;
 }
 
 int
-xfs_returnzero (void *v)
+xfs_returnzero(struct vop_generic_args *ap)
 {
-    XFSDEB(XDEBVNOPS, ("xfs_returnzero\n"));
+    XFSDEB(XDEBVNOPS, ("xfs_returnzero %s\n", ap->a_desc->vdesc_name));
     return 0;
 }
 
diff -uwr arla-0.29pre5/xfs/bsd/xfs_vnodeops-common.c arla-0.29pre5.hack/xfs/bsd/xfs_vnodeops-common.c
--- arla-0.29pre5/xfs/bsd/xfs_vnodeops-common.c	Fri Nov 26 23:58:11 1999
+++ arla-0.29pre5.hack/xfs/bsd/xfs_vnodeops-common.c	Thu Dec  9 14:14:20 1999
@@ -841,14 +841,13 @@
 	return 0;
     }
 
-    xn->tokens = 0;
-    msg.header.opcode = XFS_MSG_INACTIVENODE;
-    msg.handle = xn->handle;
-    msg.flag   = XFS_NOREFS;
-    xfs_message_send(xfsp->fd, &msg.header, sizeof(msg));
-
 #ifndef __osf__
     xfs_vfs_unlock(vp, p);
+    /* If this node is no longer valid, recycle immediately. */
+    if (!XFS_TOKEN_GOT(xn, XFS_ATTR_R | XFS_ATTR_W)) {
+        XFSDEB(XDEBVNOPS, ("xfs_inactive: vrecycle\n"));
+        vrecycle(vp, 0, p);
+    }
 #else
     /* XXX ? */
 #endif
@@ -867,6 +866,13 @@
 
     XFSDEB(XDEBVNOPS, ("xfs_reclaim: %p\n", vp));
 
+    /* Release, data if we still have it. */
+    if (DATA_FROM_XNODE(xn) != 0) {
+        vrele(DATA_FROM_XNODE(xn));
+	DATA_FROM_XNODE(xn) = 0;
+	XFS_TOKEN_CLEAR(xn, XFS_DATA_R | XFS_DATA_W, XFS_DATA_MASK);
+    }
+
     msg.header.opcode = XFS_MSG_INACTIVENODE;
     msg.handle = xn->handle;
     msg.flag   = XFS_NOREFS | XFS_DELETE;
@@ -874,6 +880,7 @@
 
     xfs_dnlc_purge(vp);
     free_xfs_node(xn);
+    vp->v_data = 0;
 
     return 0;
 }

-- 
  _     _                                               ,_______________.  
Bjorn Gronvall (Björn Grönvall)                        /_______________/|     
Swedish Institute of Computer Science                  |               ||
PO Box 1263, S-164 29 Kista, Sweden                    | Schroedingers ||
Email: bg at sics.se, Phone +46 -8 633 15 25              |      Cat      |/
Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30       `---------------' 





More information about the Arla-drinkers mailing list