Date: Mon, 6 Dec 1999 21:11:12 +0100 From: Eivind Eklund <eivind@freebsd.org> To: fs@freebsd.org Subject: NDFREE patches / architecture change Message-ID: <19991206211112.I8056@bitbox.follo.net>
next in thread | raw e-mail | index | archive | help
A patchset is available at http://www.freebsd.org/~eivind/namei-boots-with-NDFREE.patch In fact, it doesn't only boot - it also gets through 'make world' to the point where my testbox runs out of diskspace. NFS is not tested at all yet; I don't have any NFS setup at all. I'd appreciate assistance in that area (which, as I write this, seems to be coming up from Peter Wemm - thanks Peter!) This patch give the following changes to the calling conventions of the VFS: (1) Freeing of the pathname buffer (nd.ni_cnd.cn_pnbuf) is no longer done by the individual filesystems, but rather by the caller. (2) NDFREE() becomes necessary for each NDINIT()/namei() pair, even those without SAVESTART or SAVENAME in the flags, as filesystems that set the SAVENAME flag no longer frees their own pathname buffers. (3) HASBUF is expected to be cleared when you free the path name buffer (NFS already does this, the rest of the code is sloppy about it.) (4) VOP_ABORTOP() dies. I am killing this because there is now *no* code in it, and an unused code formality is not going to be adhered to correctly. Thus, I see it as pointless to keep it around, and suggest we instead re-introduce it when/if a use for it shows up. At that point, I believe the old diffs will be as useful as calls left around in the code would have been. I elected to implement a full NDFREE instead of a more limited free for just the path name buffer. This is implemented as follows (I'm extracting plain code, as I don't expect everybody to read the patches, even though I wish they would ;-) #define NDF_NO_DVP_RELE 0x00000001 #define NDF_NO_DVP_UNLOCK 0x00000002 #define NDF_NO_DVP_PUT 0x00000003 #define NDF_NO_VP_RELE 0x00000004 #define NDF_NO_VP_UNLOCK 0x00000008 #define NDF_NO_VP_PUT 0x0000000c #define NDF_NO_STARTDIR_RELE 0x00000010 #define NDF_NO_FREE_PNBUF 0x00000020 #define NDF_ONLY_PNBUF (~NDF_NO_FREE_PNBUF) #define NDFREE(ndp, flags) do { \ struct nameidata *_ndp = (ndp); \ unsigned int _flags = (flags); \ \ if (!(_flags & NDF_NO_FREE_PNBUF) && \ (_ndp->ni_cnd.cn_flags & HASBUF)) { \ zfree(namei_zone, _ndp->ni_cnd.cn_pnbuf); \ _ndp->ni_cnd.cn_flags &= ~HASBUF; \ } \ if (!(_flags & NDF_NO_DVP_UNLOCK) && \ (_ndp->ni_cnd.cn_flags & LOCKPARENT)) \ VOP_UNLOCK(_ndp->ni_dvp, 0, _ndp->ni_cnd.cn_proc); \ if (!(_flags & NDF_NO_DVP_RELE) && \ (_ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) { \ vrele(_ndp->ni_dvp); \ _ndp->ni_dvp = NULL; \ } \ if (!(_flags & NDF_NO_VP_RELE) && \ _ndp->ni_vp) { \ vrele(_ndp->ni_vp); \ _ndp->ni_vp = NULL; \ } \ if (!(_flags & NDF_NO_STARTDIR_RELE) && \ (_ndp->ni_cnd.cn_flags & SAVESTART)) { \ vrele(_ndp->ni_startdir); \ _ndp->ni_startdir = NULL; \ } \ } while (0) As you can see, this takes a series of flags to supress various parts of the free - allowing any of the return fields to be turned into an output for the function using namei(), and hopefully letting us collapse large amounts of boilerplate code that is presently around (or at least not write more of it.) The NDF_ONLY_PNBUF is intended as a hack to make it easy to convert legacy code. New code should not use it. My next step will be to hit the locking code with improved assertions, as discussed previously. Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991206211112.I8056>