Date: Tue, 4 Sep 2001 22:04:35 +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: <200109041904.f84J4ZZ99036@vega.vega.com> In-Reply-To: <12420.999618814@critter> from "Poul-Henning Kamp" at Sep 04, 2001 05:53:34 PM
next in thread | previous in thread | raw e-mail | index | archive | help
--%--multipart-mixed-boundary-2.97537.999630275--% Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > > apart from the numerical value, yes, looks good. Ok, please find the final patch attached. Dare I say that it looks really ugly? I'm looking forward for your comments. -Maxim > > Poul-Henning > > In message <200109041536.f84FaDG98107@vega.vega.com>, Maxim Sobolev writes: > > > >--%--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--%-- > > > > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by incompetence. > > --%--multipart-mixed-boundary-2.97537.999630275--% Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Description: ASCII C program text Content-Disposition: attachment; filename="v_tag.diff" Index: coda/coda.h =================================================================== RCS file: /home/ncvs/src/sys/coda/coda.h,v retrieving revision 1.9 diff -d -u -r1.9 coda.h --- coda/coda.h 1999/12/29 04:54:30 1.9 +++ coda/coda.h 2001/09/04 18:46:42 @@ -41,7 +41,7 @@ #ifndef _CODA_HEADER_ #define _CODA_HEADER_ - +#define VT_CODA "VT_CODA" /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ Index: fs/devfs/devfs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/devfs/devfs.h,v retrieving revision 1.7 diff -d -u -r1.7 devfs.h --- fs/devfs/devfs.h 2001/05/23 17:48:20 1.7 +++ fs/devfs/devfs.h 2001/09/04 18:47:23 @@ -37,6 +37,8 @@ #ifndef _FS_DEVFS_DEVFS_H_ #define _FS_DEVFS_DEVFS_H_ +#define VT_DEVFS "VT_DEVFS" + #ifdef _KERNEL /* No userland stuff in here... */ /* 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 18:47:23 @@ -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/fdescfs/fdesc.h =================================================================== RCS file: /home/ncvs/src/sys/fs/fdescfs/fdesc.h,v retrieving revision 1.14 diff -d -u -r1.14 fdesc.h --- fs/fdescfs/fdesc.h 2000/10/09 20:06:13 1.14 +++ fs/fdescfs/fdesc.h 2001/09/04 18:47:23 @@ -38,6 +38,8 @@ * $FreeBSD: src/sys/fs/fdescfs/fdesc.h,v 1.14 2000/10/09 20:06:13 chris Exp $ */ +#define VT_FDESC "VT_FDESC" + #ifdef _KERNEL struct fdescmount { struct vnode *f_root; /* Root node */ Index: fs/hpfs/hpfs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/hpfs/hpfs.h,v retrieving revision 1.6 diff -d -u -r1.6 hpfs.h --- fs/hpfs/hpfs.h 2001/04/25 07:07:43 1.6 +++ fs/hpfs/hpfs.h 2001/09/04 18:47:28 @@ -44,6 +44,8 @@ #define BMSIZE (4 * DEV_BSIZE) #define HPFS_MAXFILENAME 255 +#define VT_HPFS "VT_HPFS" + #define SU_MAGIC ((u_int64_t)0xFA53E9C5F995E849) struct sublock { u_int64_t su_magic; Index: fs/msdosfs/fat.h =================================================================== RCS file: /home/ncvs/src/sys/fs/msdosfs/fat.h,v retrieving revision 1.9 diff -d -u -r1.9 fat.h --- fs/msdosfs/fat.h 1999/12/29 04:54:53 1.9 +++ fs/msdosfs/fat.h 2001/09/04 18:47:28 @@ -83,6 +83,8 @@ #define MSDOSFSEOF(pmp, cn) ((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS) +#define VT_MSDOSFS "VT_MSDOSFS" + #ifdef _KERNEL /* * These are the values for the function argument to the function 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 18:47:28 @@ -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; Index: fs/msdosfs/msdosfs_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/fs/msdosfs/msdosfs_vfsops.c,v retrieving revision 1.79 diff -d -u -r1.79 msdosfs_vfsops.c --- fs/msdosfs/msdosfs_vfsops.c 2001/06/28 03:47:50 1.79 +++ fs/msdosfs/msdosfs_vfsops.c 2001/09/04 18:47:28 @@ -770,8 +770,8 @@ TAILQ_FIRST(&vp->v_cleanblkhd), TAILQ_FIRST(&vp->v_dirtyblkhd), vp->v_numoutput, vp->v_type); - printf("union %p, tag %d, data[0] %08x, data[1] %08x\n", - vp->v_socket, vp->v_tag, + printf("union %p, tag %s, data[0] %08x, data[1] %08x\n", + vp->v_socket, vp->v_tag != NULL ? vp->v_tag : "VT_NON", ((u_int *)vp->v_data)[0], ((u_int *)vp->v_data)[1]); } Index: fs/ntfs/ntfs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs.h,v retrieving revision 1.10 diff -d -u -r1.10 ntfs.h --- fs/ntfs/ntfs.h 2001/04/25 07:07:48 1.10 +++ fs/ntfs/ntfs.h 2001/09/04 18:47:33 @@ -36,6 +36,8 @@ typedef u_int64_t cn_t; typedef u_int16_t wchar; +#define VT_NTFS "VT_NTFS" + #pragma pack(1) #define BBSIZE 1024 #define BBOFF ((off_t)(0)) Index: fs/nullfs/null.h =================================================================== RCS file: /home/ncvs/src/sys/fs/nullfs/null.h,v retrieving revision 1.15 diff -d -u -r1.15 null.h --- fs/nullfs/null.h 2000/09/05 09:02:07 1.15 +++ fs/nullfs/null.h 2001/09/04 18:47:33 @@ -47,6 +47,8 @@ struct vnode *nullm_rootvp; /* Reference to root null_node */ }; +#define VT_NULL "VT_NULL" + #ifdef _KERNEL /* * A cache of vnode references Index: fs/nwfs/nwfs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/nwfs/nwfs.h,v retrieving revision 1.4 diff -d -u -r1.4 nwfs.h --- fs/nwfs/nwfs.h 2001/05/26 11:57:37 1.4 +++ fs/nwfs/nwfs.h 2001/09/04 18:47:33 @@ -49,6 +49,8 @@ #define NWFSIOC_GETEINFO _IOR('n',2,struct nw_entry_info) #define NWFSIOC_GETNS _IOR('n',3,int) +#define VT_NWFS "VT_NWFS" + #ifdef _KERNEL #include <sys/vnode.h> Index: fs/portalfs/portal.h =================================================================== RCS file: /home/ncvs/src/sys/fs/portalfs/portal.h,v retrieving revision 1.7 diff -d -u -r1.7 portal.h --- fs/portalfs/portal.h 1999/12/29 04:54:45 1.7 +++ fs/portalfs/portal.h 2001/09/04 18:47:33 @@ -67,5 +67,7 @@ #define PORTAL_ROOTFILEID 2 +#define VT_PORTAL "VT_PORTAL" + extern vop_t **portal_vnodeop_p; #endif /* _KERNEL */ Index: fs/procfs/procfs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/procfs/procfs.h,v retrieving revision 1.37 diff -d -u -r1.37 procfs.h --- fs/procfs/procfs.h 2001/08/03 17:51:05 1.37 +++ fs/procfs/procfs.h 2001/09/04 18:47:33 @@ -80,6 +80,8 @@ #define PROCFS_CTLLEN 8 /* max length of a ctl msg (/proc/$pid/ctl */ #define PROCFS_NAMELEN 8 /* max length of a filename component */ +#define VT_PROCFS "VT_PROCFS" + /* * Kernel stuff follows */ Index: fs/pseudofs/pseudofs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/pseudofs/pseudofs.h,v retrieving revision 1.5 diff -d -u -r1.5 pseudofs.h --- fs/pseudofs/pseudofs.h 2001/06/10 21:37:11 1.5 +++ fs/pseudofs/pseudofs.h 2001/09/04 18:47:33 @@ -37,6 +37,8 @@ #define PFS_NAMELEN 24 #define PFS_DELEN (8 + PFS_NAMELEN) +#define VT_PSEUDOFS "VT_PSEUDOFS" + typedef enum { pfstype_none = 0, pfstype_root, Index: fs/smbfs/smbfs.h =================================================================== RCS file: /home/ncvs/src/sys/fs/smbfs/smbfs.h,v retrieving revision 1.2 diff -d -u -r1.2 smbfs.h --- fs/smbfs/smbfs.h 2001/04/13 11:26:54 1.2 +++ fs/smbfs/smbfs.h 2001/09/04 18:47:33 @@ -48,6 +48,7 @@ #define SMBFS_MAXPATHCOMP 256 /* maximum number of path components */ +#define VT_SMBFS "VT_SMBFS" /* Layout of the mount control block for a netware file system. */ struct smbfs_args { Index: fs/umapfs/umap.h =================================================================== RCS file: /home/ncvs/src/sys/fs/umapfs/umap.h,v retrieving revision 1.15 diff -d -u -r1.15 umap.h --- fs/umapfs/umap.h 2000/05/26 02:05:04 1.15 +++ fs/umapfs/umap.h 2001/09/04 18:47:33 @@ -43,6 +43,8 @@ #define NOBODY 32767 #define NULLGROUP 65534 +#define VT_UMAP "VT_UMAP" + struct umap_args { char *target; /* Target of loopback */ int nentries; /* # of entries in user map array */ Index: fs/unionfs/union.h =================================================================== RCS file: /home/ncvs/src/sys/fs/unionfs/union.h,v retrieving revision 1.20 diff -d -u -r1.20 union.h --- fs/unionfs/union.h 2001/05/17 04:52:57 1.20 +++ fs/unionfs/union.h 2001/09/04 18:47:33 @@ -48,6 +48,8 @@ #define UNMNT_REPLACE 0x0003 /* Target replaces mount point */ #define UNMNT_OPMASK 0x0003 +#define VT_UNION "VT_UNION" + struct union_mount { struct vnode *um_uppervp; /* UN_ULOCK holds locking state */ struct vnode *um_lowervp; /* Left unlocked */ Index: fs/unionfs/union_subr.c =================================================================== RCS file: /home/ncvs/src/sys/fs/unionfs/union_subr.c,v retrieving revision 1.54 diff -d -u -r1.54 union_subr.c --- fs/unionfs/union_subr.c 2001/05/23 09:42:13 1.54 +++ fs/unionfs/union_subr.c 2001/09/04 18:47:40 @@ -443,7 +443,9 @@ do { scan = VTOUNION(scan)->un_pvp; - } while (scan && scan->v_tag == VT_UNION && scan != dvp); + } while (scan && scan->v_tag != NULL && + /* XXX: ABUSE OF v_tag */ + strcmp(scan->v_tag, VT_UNION) == 0 && scan != dvp); if (scan != dvp) { /* * our new un is above dvp (we never saw dvp Index: isofs/cd9660/cd9660_mount.h =================================================================== RCS file: /home/ncvs/src/sys/isofs/cd9660/cd9660_mount.h,v retrieving revision 1.5 diff -d -u -r1.5 cd9660_mount.h --- isofs/cd9660/cd9660_mount.h 2001/03/11 10:05:08 1.5 +++ isofs/cd9660/cd9660_mount.h 2001/09/04 18:48:02 @@ -39,6 +39,8 @@ * $FreeBSD: src/sys/isofs/cd9660/cd9660_mount.h,v 1.5 2001/03/11 10:05:08 bp Exp $ */ +#define VT_ISOFS "VT_ISOFS" + /* * Arguments to mount ISO 9660 filesystems. */ 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 18:48:16 @@ -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: kern/kern_descrip.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.104 diff -d -u -r1.104 kern_descrip.c --- kern/kern_descrip.c 2001/08/23 13:19:32 1.104 +++ kern/kern_descrip.c 2001/09/04 18:48:16 @@ -66,6 +66,8 @@ #include <vm/vm.h> #include <vm/vm_extern.h> +#include <fs/procfs/procfs.h> + static MALLOC_DEFINE(M_FILEDESC, "file desc", "Open file descriptor table"); MALLOC_DEFINE(M_FILE, "file", "Open file structure"); static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); @@ -1102,9 +1104,13 @@ static int is_unsafe(struct file *fp) { - if (fp->f_type == DTYPE_VNODE && - ((struct vnode *)(fp->f_data))->v_tag == VT_PROCFS) - return (1); + + if (fp->f_type == DTYPE_VNODE) { + /* XXX: ABUSE OF v_tag */ + const char *tag= ((struct vnode *)(fp->f_data))->v_tag; + if (tag != NULL && strcmp(tag, VT_PROCFS) == 0) + return (1); + } return (0); } Index: kern/vfs_bio.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v retrieving revision 1.287 diff -d -u -r1.287 vfs_bio.c --- kern/vfs_bio.c 2001/08/22 18:10:37 1.287 +++ kern/vfs_bio.c 2001/09/04 18:48:29 @@ -159,6 +159,8 @@ #define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ #define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ +#define VT_NFS "VT_NFS" /* XXX */ + /* * Buffer hash table code. Note that the logical block scans linearly, which * gives us some L1 cache locality. @@ -1122,8 +1124,8 @@ * around to prevent it from being reconstituted and starting a second * background write. */ - if ((bp->b_flags & B_VMIO) - && !(bp->b_vp->v_tag == VT_NFS && + if ((bp->b_flags & B_VMIO) && bp->b_vp->v_tag != NULL + && !((strcmp(bp->b_vp->v_tag, VT_NFS) == 0) && /* XXX: ABUSE OF v_tag */ !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI)) ) { Index: kern/vfs_subr.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.318 diff -d -u -r1.318 vfs_subr.c --- kern/vfs_subr.c 2001/08/27 06:09:54 1.318 +++ kern/vfs_subr.c 2001/09/04 18:48:42 @@ -518,7 +518,7 @@ */ int getnewvnode(tag, mp, vops, vpp) - enum vtagtype tag; + const char *tag; struct mount *mp; vop_t **vops; struct vnode **vpp; @@ -1061,7 +1061,8 @@ */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && !vn_isdisk(vp, NULL)) - panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); + panic("sched_sync: fsync failed vp %p tag %s", + vp, vp->v_tag != NULL ? vp->v_tag : "VT_NON"); /* * Put us back on the worklist. The worklist * routine will remove us from our current @@ -1338,7 +1339,7 @@ } if (vfinddev(dev, VCHR, vpp)) return (0); - error = getnewvnode(VT_NON, (struct mount *)0, spec_vnodeop_p, &nvp); + error = getnewvnode(NULL, (struct mount *)0, spec_vnodeop_p, &nvp); if (error) { *vpp = NULLVP; return (error); @@ -1863,7 +1864,7 @@ */ vp->v_op = dead_vnodeop_p; vn_pollgone(vp); - vp->v_tag = VT_NON; + vp->v_tag = NULL; vp->v_flag &= ~VXLOCK; vp->v_vxproc = NULL; if (vp->v_flag & VXWANT) { @@ -2605,7 +2606,7 @@ int error; /* Allocate a new vnode */ - if ((error = getnewvnode(VT_VFS, mp, sync_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("VT_VFS", mp, sync_vnodeop_p, &vp)) != 0) { mp->mnt_syncer = NULL; return (error); } Index: nfs/nfs.h =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs.h,v retrieving revision 1.59 diff -d -u -r1.59 nfs.h --- nfs/nfs.h 2001/04/17 20:45:21 1.59 +++ nfs/nfs.h 2001/09/04 18:48:48 @@ -44,6 +44,8 @@ #include "opt_nfs.h" #endif +#define VT_NFS "VT_NFS" + /* * Tunable constants for nfs */ 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 18:48:48 @@ -232,6 +232,7 @@ } vp = nvp; bzero((caddr_t)np, sizeof *np); + vp->v_flag |= VLOCKABLE; vp->v_data = np; np->n_vnode = vp; /* @@ -393,7 +394,7 @@ vp->v_flag |= VXWANT; (void) tsleep((caddr_t)vp, PINOD, "nfslck", 0); } - if (vp->v_tag == VT_NON) + if (vp->v_tag == NULL) return (ENOENT); #if 0 Index: nfsclient/nfs_node.c =================================================================== RCS file: /home/ncvs/src/sys/nfsclient/nfs_node.c,v retrieving revision 1.49 diff -d -u -r1.49 nfs_node.c --- nfsclient/nfs_node.c 2001/05/01 08:13:14 1.49 +++ nfsclient/nfs_node.c 2001/09/04 18:48:55 @@ -393,7 +393,7 @@ vp->v_flag |= VXWANT; (void) tsleep((caddr_t)vp, PINOD, "nfslck", 0); } - if (vp->v_tag == VT_NON) + if (vp->v_tag == NULL) return (ENOENT); #if 0 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 18:49:14 @@ -62,18 +62,6 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; /* - * Vnode tag types. - * These are for the benefit of external programs only (e.g., pstat) - * and should NEVER be inspected by the kernel. - */ -enum vtagtype { - VT_NON, VT_UFS, VT_NFS, VT_UNUSED, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, - VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, - VT_HPFS, VT_NWFS, VT_PSEUDOFS, VT_SMBFS -}; - -/* * Each underlying filesystem allocates its own private area and hangs * it from v_data. If non-null, this area is freed in getnewvnode(). */ @@ -123,7 +111,7 @@ struct mtx v_interlock; /* lock on usecount and flag */ struct lock v_lock; /* used if fs don't have one */ struct lock *v_vnlock; /* pointer to vnode lock */ - enum vtagtype v_tag; /* type of underlying data */ + const char *v_tag; /* type of underlying data */ void *v_data; /* private data for fs */ LIST_HEAD(, namecache) v_cache_src; /* Cache entries from us */ TAILQ_HEAD(, namecache) v_cache_dst; /* Cache entries to us */ @@ -175,6 +163,7 @@ /* open for business 0x100000 */ #define VONWORKLST 0x200000 /* On syncer work-list */ #define VMOUNT 0x400000 /* Mount in progress */ +#define VLOCKABLE 0x800000 /* vnode supports locking */ /* * Vnode attributes. A field value of VNOVAL represents a field whose value @@ -433,12 +422,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 { \ @@ -561,7 +545,7 @@ void cache_purgeleafdirs __P((int ndir)); void cvtstat __P((struct stat *st, struct ostat *ost)); void cvtnstat __P((struct stat *sb, struct nstat *nsb)); -int getnewvnode __P((enum vtagtype tag, +int getnewvnode __P((const char *tag, struct mount *mp, vop_t **vops, struct vnode **vpp)); int lease_check __P((struct vop_lease_args *ap)); int spec_vnoperate __P((struct vop_generic_args *)); 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 18:49:14 @@ -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 18:49:14 @@ -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: ufs/ufs/ufsmount.h =================================================================== RCS file: /home/ncvs/src/sys/ufs/ufs/ufsmount.h,v retrieving revision 1.21 diff -d -u -r1.21 ufsmount.h --- ufs/ufs/ufsmount.h 2001/05/29 21:21:53 1.21 +++ ufs/ufs/ufsmount.h 2001/09/04 18:49:14 @@ -37,6 +37,8 @@ #ifndef _UFS_UFS_UFSMOUNT_H_ #define _UFS_UFS_UFSMOUNT_H_ +#define VT_UFS "VT_UFS" + /* * Arguments to mount UFS-based filesystems */ Index: vm/vm_swap.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_swap.c,v retrieving revision 1.110 diff -d -u -r1.110 vm_swap.c --- vm/vm_swap.c 2001/07/28 20:18:38 1.110 +++ vm/vm_swap.c 2001/09/04 18:49:15 @@ -65,6 +65,7 @@ #ifndef NSWAPDEV #define NSWAPDEV 4 #endif +#define VT_NFS "VT_NFS" /* XXX */ static struct swdevt should_be_malloced[NSWAPDEV]; struct swdevt *swdevt = should_be_malloced; static int nswap; /* first block after the interleaved devs */ @@ -215,7 +216,8 @@ if (vn_isdisk(vp, &error)) error = swaponvp(p, vp, vp->v_rdev, 0); - else if (vp->v_type == VREG && vp->v_tag == VT_NFS && + else if (vp->v_type == VREG && vp->v_tag != NULL && + strcmp(vp->v_tag, VT_NFS) == 0 && /* XXX: ABUSE of v_tag */ (error = VOP_GETATTR(vp, &attr, p->p_ucred, p)) == 0) { /* * Allow direct swapping to NFS regular files in the same @@ -257,7 +259,7 @@ u_long aligned_nblks; if (!swapdev_vp) { - error = getnewvnode(VT_NON, NULL, swapdev_vnodeop_p, + error = getnewvnode(NULL, NULL, swapdev_vnodeop_p, &swapdev_vp); if (error) panic("Cannot get vnode for swapdev"); --%--multipart-mixed-boundary-2.97537.999630275--%-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109041904.f84J4ZZ99036>