Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Sep 2001 18:35:32 +0300 (EEST)
From:      Maxim Sobolev <sobomax@FreeBSD.ORG>
To:        phk@critter.freebsd.dk (Poul-Henning Kamp)
Cc:        sobomax@FreeBSD.ORG (Maxim Sobolev), brent@rcfile.org (Brent Verner), current@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: Junior Kernel Hacker task: improve vnode->v_tag
Message-ID:  <200109041536.f84FaDG98107@vega.vega.com>
In-Reply-To: <57177.999611955@critter> from "Poul-Henning Kamp" at Sep 04, 2001 03:59:15 PM

next in thread | previous in thread | raw e-mail | index | archive | help

--%--multipart-mixed-boundary-1.97537.999617732--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> In message <200109041343.f84DhO097646@vega.vega.com>, Maxim Sobolev writes:
> >> 
> >> In message <20010904081337.A8968@rcfile.org>, Brent Verner writes:
> >> >
> >> >I've done a /cursory/ look over how this v_tag is used.  I'm not sure
> >> >this is a simple/clean as you propose, since this is used in the 
> >> >IS_LOCKING_VFS macro, as well as in union_subr.c...
> >> 
> > Well, that is just too bad, because IS_LOCKING_VFS is wrong then.
> >> 
> >> The places which inspect v_tag will have to be changed to use
> >> strcmp() then...
> >
> >I think that we can add a new vnode flag, say VCANLOCK, so that each
> >particular VFS can set it if it supports locking, which should allow
> >to remove pre-defined VFS list from the IS_LOCKING_VFS macro. I can
> >produce a patch if it sounds reasonably.
> 
> Yeah, I think that makes a lot of sense.

See attached. Please let me know if it is OK for you.

-Maxim

--%--multipart-mixed-boundary-1.97537.999617732--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: ASCII C program text
Content-Disposition: attachment; filename="p"

Index: isofs/cd9660/cd9660_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/isofs/cd9660/cd9660_vfsops.c,v
retrieving revision 1.91
diff -d -u -r1.91 cd9660_vfsops.c
--- isofs/cd9660/cd9660_vfsops.c	2001/05/16 18:04:30	1.91
+++ isofs/cd9660/cd9660_vfsops.c	2001/09/04 15:20:46
@@ -697,6 +697,7 @@
 	}
 	MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE,
 	    M_WAITOK | M_ZERO);
+	vp->v_flag |= VLOCKABLE;
 	lockinit(&vp->v_lock, PINOD, "isonode", 0, 0);
 	/*
 	 * ISOFS uses stdlock and can share lock structure
Index: ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.157
diff -d -u -r1.157 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c	2001/06/28 22:21:27	1.157
+++ ufs/ffs/ffs_vfsops.c	2001/09/04 15:21:25
@@ -1172,6 +1172,7 @@
 		return (error);
 	}
 	bzero((caddr_t)ip, sizeof(struct inode));
+	vp->v_flag |= VLOCKABLE;
 	/*
 	 * FFS supports lock sharing in the stack of vnodes
 	 */
Index: ufs/ifs/ifs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ifs/ifs_vfsops.c,v
retrieving revision 1.6
diff -d -u -r1.6 ifs_vfsops.c
--- ufs/ifs/ifs_vfsops.c	2001/04/25 07:07:51	1.6
+++ ufs/ifs/ifs_vfsops.c	2001/09/04 15:21:25
@@ -217,6 +217,7 @@
 		return (error);
 	}
 	bzero((caddr_t)ip, sizeof(struct inode));
+	vp->v_flag |= VLOCKABLE;
 	/*
 	 * IFS supports lock sharing in the stack of vnodes
 	 */
Index: nfs/nfs_node.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_node.c,v
retrieving revision 1.49
diff -d -u -r1.49 nfs_node.c
--- nfs/nfs_node.c	2001/05/01 08:13:14	1.49
+++ nfs/nfs_node.c	2001/09/04 15:21:25
@@ -232,6 +232,7 @@
 	}
 	vp = nvp;
 	bzero((caddr_t)np, sizeof *np);
+	vp->v_flag |= VLOCKABLE;
 	vp->v_data = np;
 	np->n_vnode = vp;
 	/*
Index: sys/vnode.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/vnode.h,v
retrieving revision 1.154
diff -d -u -r1.154 vnode.h
--- sys/vnode.h	2001/08/27 06:09:55	1.154
+++ sys/vnode.h	2001/09/04 15:21:25
@@ -175,6 +175,7 @@
 /* open for business	0x100000 */
 #define	VONWORKLST	0x200000 /* On syncer work-list */
 #define	VMOUNT		0x400000 /* Mount in progress */
+#define VLOCKABLE	0x600000 /* vnode supports locking */
 
 /*
  * Vnode attributes.  A field value of VNOVAL represents a field whose value
@@ -433,12 +434,7 @@
 /*
  * [dfr] Kludge until I get around to fixing all the vfs locking.
  */
-#define IS_LOCKING_VFS(vp)	((vp)->v_tag == VT_UFS			\
-				 || (vp)->v_tag == VT_NFS		\
-				 || (vp)->v_tag == VT_LFS		\
-				 || (vp)->v_tag == VT_ISOFS		\
-				 || (vp)->v_tag == VT_MSDOSFS		\
-				 || (vp)->v_tag == VT_DEVFS)
+#define IS_LOCKING_VFS(vp)	((vp)->v_flag & VLOCKABLE)
 
 #define ASSERT_VOP_LOCKED(vp, str)					\
 do {									\
Index: fs/devfs/devfs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/devfs/devfs_vnops.c,v
retrieving revision 1.27
diff -d -u -r1.27 devfs_vnops.c
--- fs/devfs/devfs_vnops.c	2001/08/14 06:42:32	1.27
+++ fs/devfs/devfs_vnops.c	2001/09/04 15:21:25
@@ -151,6 +151,7 @@
 	} else {
 		vp->v_type = VBAD;
 	}
+	vp->v_flag |= VLOCKABLE;
 	vp->v_data = de;
 	de->de_vnode = vp;
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
Index: fs/msdosfs/msdosfs_denode.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/msdosfs/msdosfs_denode.c,v
retrieving revision 1.57
diff -d -u -r1.57 msdosfs_denode.c
--- fs/msdosfs/msdosfs_denode.c	2001/05/25 08:14:09	1.57
+++ fs/msdosfs/msdosfs_denode.c	2001/09/04 15:21:33
@@ -261,6 +261,7 @@
 		return error;
 	}
 	bzero((caddr_t)ldep, sizeof *ldep);
+	nvp->v_flag |= VLOCKABLE;
 	lockinit(&nvp->v_lock, PINOD, "denode", 0, 0);
 	nvp->v_vnlock = &nvp->v_lock;
 	nvp->v_data = ldep;

--%--multipart-mixed-boundary-1.97537.999617732--%--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109041536.f84FaDG98107>