From owner-freebsd-arch Thu Sep 12 3:36:34 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1FF2937B400; Thu, 12 Sep 2002 03:36:31 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id A21EA43E3B; Thu, 12 Sep 2002 03:36:29 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id UAA22089; Thu, 12 Sep 2002 20:36:24 +1000 Date: Thu, 12 Sep 2002 20:40:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson Cc: phk@FreeBSD.ORG, , Subject: Re: PATCH: vnode->v_tag to const char * In-Reply-To: Message-ID: <20020912202409.Y5891-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 11 Sep 2002, Nate Lawson wrote: > On Thu, 12 Sep 2002, Bruce Evans wrote: > > On Tue, 10 Sep 2002, Nate Lawson wrote: > > > * kern/vfs_bio.c, vm/vm_swap.c - detecting NFS vnode is now done via: > > > vp->v_mount->mnt_stat.f_type == nfs_mount_type > > > Since NFS does this itself, I'm guessing it's the accepted way. > > > > I don't like this. I can't find where nfs does this now, but remember > > thinking that this method doesn't work in general because nfs's variable > > can only be referenced if nfs is loaded. > > Here are the current places that reference nfs_mount_type: > > kern/vfs_subr.c:int nfs_mount_type = -1; > sys/mount.h:extern int nfs_mount_type; /* vfc_typenum for nfs, or -1 */ > vm/vnode_pager.c: (vp->v_mount->mnt_stat.f_type != > nfs_mount_type)) { > > As you can see, NFS does not need to be loaded and this var is already > ref'd in the vm code. For vm_swap.c, the code is seeing if it is enabling > swapping to a file on an NFS-mounted fs, so v_mount has to be non-NULL. This would be more convincing if the variable were actually initialized to something other than -1 :-). The non-null initialization was removed without comment in nfsclient/nfs_subs.c rev.1.105 (after a repo copy from nfs/nfs_subs.c rev.1.104), perhaps because the variable appeared to be a private to nfs and its one user in nfs (nfs_nqlease.c) went away. I wonder why no one noticed the effect of this on vm_swap.c. > The only other option I considered was checking v_op == nfsv2_vnodeop_p > but that has huge problems in that the vops for NFS are only present when > NFS is loaded. > > If you have a better solution, I'm open to it. I guess the global is the least of evils. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message