CVS commit: src/sys/fs/filecorefs
Module Name:src Committed By: hannken Date: Sat Oct 4 13:27:24 UTC 2014 Modified Files: src/sys/fs/filecorefs: filecore_lookup.c filecore_node.c filecore_node.h filecore_vfsops.c Log Message: Change filecore to vcache. Compile-tested only, was not able to get my hands on a readable fs image. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/fs/filecorefs/filecore_lookup.c cvs rdiff -u -r1.26 -r1.27 src/sys/fs/filecorefs/filecore_node.c cvs rdiff -u -r1.5 -r1.6 src/sys/fs/filecorefs/filecore_node.h cvs rdiff -u -r1.76 -r1.77 src/sys/fs/filecorefs/filecore_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/filecorefs/filecore_lookup.c diff -u src/sys/fs/filecorefs/filecore_lookup.c:1.20 src/sys/fs/filecorefs/filecore_lookup.c:1.21 --- src/sys/fs/filecorefs/filecore_lookup.c:1.20 Tue Jun 3 19:30:30 2014 +++ src/sys/fs/filecorefs/filecore_lookup.c Sat Oct 4 13:27:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_lookup.c,v 1.20 2014/06/03 19:30:30 joerg Exp $ */ +/* $NetBSD: filecore_lookup.c,v 1.21 2014/10/04 13:27:24 hannken Exp $ */ /*- * Copyright (c) 1989, 1993, 1994 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: filecore_lookup.c,v 1.20 2014/06/03 19:30:30 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: filecore_lookup.c,v 1.21 2014/10/04 13:27:24 hannken Exp $); #include sys/param.h #include sys/namei.h @@ -128,8 +128,6 @@ filecore_lookup(void *v) struct buf *bp; /* a buffer of directory entries */ struct filecore_direntry *de; int numdirpasses; /* strategy for directory search */ - struct vnode *pdp; /* saved dp during symlink work */ - struct vnode *tdp; /* returned by filecore_vget_internal */ int error; u_short namelen; int res; @@ -259,54 +257,24 @@ found: if ((flags ISLASTCN) nameiop == LOOKUP) dp-i_diroff = i; - /* - * Step through the translation in the name. We do not `iput' the - * directory because we may need it again if a symbolic link - * is relative to the current directory. Instead we save it - * unlocked as pdp. We must get the target inode before unlocking - * the directory to insure that the inode will not be removed - * before we get it. We prevent deadlock by always fetching - * inodes from the root, moving down the directory tree. Thus - * when following backward pointers .. we must unlock the - * parent directory before getting the requested directory. - * There is a potential race condition here if both the current - * and parent directories are removed before the `iget' for the - * inode associated with .. returns. We hope that this occurs - * infrequently since we cannot avoid this race condition without - * implementing a sophisticated deadlock detection algorithm. - * Note also that this simple deadlock detection scheme will not - * work if the file system has any hard links other than .. - * that point backwards in the directory structure. - */ - pdp = vdp; - - /* - * If ino is different from dp-i_ino, - * it's a relocated directory. - */ - if (flags ISDOTDOT) { - ino_t pin = filecore_getparent(dp); - - VOP_UNLOCK(pdp); /* race to get the inode */ - error = VFS_VGET(vdp-v_mount, pin, tdp); - vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY); - if (error) { - return error; - } - *vpp = tdp; - } else if (name[0] == '.' namelen == 1) { + if (name[0] == '.' namelen == 1) { vref(vdp); /* we want ourself, ie . */ *vpp = vdp; } else { + ino_t ino; + + if (flags ISDOTDOT) { + ino = filecore_getparent(dp); + } else { + ino = dp-i_dirent.addr | (i FILECORE_INO_INDEX); #ifdef FILECORE_DEBUG_BR printf(brelse(%p) lo4\n, bp); #endif - brelse(bp, 0); - error = VFS_VGET(vdp-v_mount, dp-i_dirent.addr | - (i FILECORE_INO_INDEX), tdp); + brelse(bp, 0); + } + error = vcache_get(vdp-v_mount, ino, sizeof(ino), vpp); if (error) - return (error); - *vpp = tdp; + return error; } /* @@ -314,7 +282,5 @@ found: */ cache_enter(vdp, *vpp, cnp-cn_nameptr, cnp-cn_namelen, cnp-cn_flags); - if (*vpp != vdp) - VOP_UNLOCK(*vpp); return 0; } Index: src/sys/fs/filecorefs/filecore_node.c diff -u src/sys/fs/filecorefs/filecore_node.c:1.26 src/sys/fs/filecorefs/filecore_node.c:1.27 --- src/sys/fs/filecorefs/filecore_node.c:1.26 Thu Feb 27 16:51:38 2014 +++ src/sys/fs/filecorefs/filecore_node.c Sat Oct 4 13:27:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_node.c,v 1.26 2014/02/27 16:51:38 hannken Exp $ */ +/* $NetBSD: filecore_node.c,v 1.27 2014/10/04 13:27:24 hannken Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1994 @@ -67,7 +67,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: filecore_node.c,v 1.26 2014/02/27 16:51:38 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: filecore_node.c,v 1.27 2014/10/04 13:27:24 hannken Exp $); #include
CVS commit: src/sys/fs/filecorefs
Module Name:src Committed By: mlelstv Date: Wed Dec 25 11:11:55 UTC 2013 Modified Files: src/sys/fs/filecorefs: filecore_vfsops.c Log Message: At least fetch the mount data pointer before using it. Coverity CID 274525 To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/fs/filecorefs/filecore_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/filecorefs/filecore_vfsops.c diff -u src/sys/fs/filecorefs/filecore_vfsops.c:1.72 src/sys/fs/filecorefs/filecore_vfsops.c:1.73 --- src/sys/fs/filecorefs/filecore_vfsops.c:1.72 Sat Nov 23 13:35:36 2013 +++ src/sys/fs/filecorefs/filecore_vfsops.c Wed Dec 25 11:11:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_vfsops.c,v 1.72 2013/11/23 13:35:36 christos Exp $ */ +/* $NetBSD: filecore_vfsops.c,v 1.73 2013/12/25 11:11:55 mlelstv Exp $ */ /*- * Copyright (c) 1994 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: filecore_vfsops.c,v 1.72 2013/11/23 13:35:36 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: filecore_vfsops.c,v 1.73 2013/12/25 11:11:55 mlelstv Exp $); #if defined(_KERNEL_OPT) #include opt_compat_netbsd.h @@ -290,6 +290,7 @@ filecore_mount(struct mount *mp, const c if ((mp-mnt_flag MNT_UPDATE) == 0) error = filecore_mountfs(devvp, mp, l, args); else { + fcmp = VFSTOFILECORE(mp); if (devvp != fcmp-fc_devvp) error = EINVAL; /* needs translation */ else
CVS commit: src/sys/fs/filecorefs
Module Name:src Committed By: christos Date: Sun Oct 20 17:14:48 UTC 2013 Modified Files: src/sys/fs/filecorefs: filecore_lookup.c filecore_vnops.c Log Message: remove unused To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/fs/filecorefs/filecore_lookup.c cvs rdiff -u -r1.38 -r1.39 src/sys/fs/filecorefs/filecore_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/filecorefs/filecore_lookup.c diff -u src/sys/fs/filecorefs/filecore_lookup.c:1.17 src/sys/fs/filecorefs/filecore_lookup.c:1.18 --- src/sys/fs/filecorefs/filecore_lookup.c:1.17 Thu Dec 20 03:03:42 2012 +++ src/sys/fs/filecorefs/filecore_lookup.c Sun Oct 20 13:14:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_lookup.c,v 1.17 2012/12/20 08:03:42 hannken Exp $ */ +/* $NetBSD: filecore_lookup.c,v 1.18 2013/10/20 17:14:48 christos Exp $ */ /*- * Copyright (c) 1989, 1993, 1994 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: filecore_lookup.c,v 1.17 2012/12/20 08:03:42 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: filecore_lookup.c,v 1.18 2013/10/20 17:14:48 christos Exp $); #include sys/param.h #include sys/namei.h @@ -127,7 +127,6 @@ filecore_lookup(void *v) } */ *ap = v; struct vnode *vdp; /* vnode for directory being searched */ struct filecore_node *dp; /* inode for directory being searched */ - struct filecore_mnt *fcmp; /* file system that directory is in */ struct buf *bp; /* a buffer of directory entries */ struct filecore_direntry *de; int numdirpasses; /* strategy for directory search */ @@ -150,7 +149,6 @@ filecore_lookup(void *v) *vpp = NULL; vdp = ap-a_dvp; dp = VTOI(vdp); - fcmp = dp-i_mnt; /* * Check accessiblity of directory. Index: src/sys/fs/filecorefs/filecore_vnops.c diff -u src/sys/fs/filecorefs/filecore_vnops.c:1.38 src/sys/fs/filecorefs/filecore_vnops.c:1.39 --- src/sys/fs/filecorefs/filecore_vnops.c:1.38 Sun Jun 23 03:28:36 2013 +++ src/sys/fs/filecorefs/filecore_vnops.c Sun Oct 20 13:14:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_vnops.c,v 1.38 2013/06/23 07:28:36 dholland Exp $ */ +/* $NetBSD: filecore_vnops.c,v 1.39 2013/10/20 17:14:48 christos Exp $ */ /*- * Copyright (c) 1994 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: filecore_vnops.c,v 1.38 2013/06/23 07:28:36 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: filecore_vnops.c,v 1.39 2013/10/20 17:14:48 christos Exp $); #include sys/param.h #include sys/systm.h @@ -204,7 +204,7 @@ filecore_read(void *v) struct filecore_node *ip = VTOI(vp); struct filecore_mnt *fcmp; struct buf *bp; - daddr_t lbn, rablock; + daddr_t lbn; off_t diff; int error = 0; long size, n, on; @@ -248,7 +248,6 @@ filecore_read(void *v) if (diff n) n = diff; size = filecore_blksize(fcmp, ip, lbn); - rablock = lbn + 1; if (ip-i_dirent.attr FILECORE_ATTR_DIR) { error = filecore_dbread(ip, bp); on = uio-uio_offset; @@ -294,7 +293,6 @@ filecore_readdir(void *v) struct uio *uio = ap-a_uio; struct vnode *vdp = ap-a_vp; struct filecore_node *dp; - struct filecore_mnt *fcmp; struct buf *bp = NULL; struct dirent *de; struct filecore_direntry *dep = NULL; @@ -315,7 +313,6 @@ filecore_readdir(void *v) uiooff = uio-uio_offset; *ap-a_eofflag = 0; - fcmp = dp-i_mnt; error = filecore_dbread(dp, bp); if (error) {
CVS commit: src/sys/fs/filecorefs
Module Name:src Committed By: dholland Date: Wed Jun 19 18:16:10 UTC 2013 Modified Files: src/sys/fs/filecorefs: filecore_extern.h filecore_vnops.c Log Message: blkoff() - filecore_blkoff() blksize() - filecore_blksize() To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/fs/filecorefs/filecore_extern.h cvs rdiff -u -r1.36 -r1.37 src/sys/fs/filecorefs/filecore_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/filecorefs/filecore_extern.h diff -u src/sys/fs/filecorefs/filecore_extern.h:1.20 src/sys/fs/filecorefs/filecore_extern.h:1.21 --- src/sys/fs/filecorefs/filecore_extern.h:1.20 Mon May 23 22:00:30 2011 +++ src/sys/fs/filecorefs/filecore_extern.h Wed Jun 19 18:16:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_extern.h,v 1.20 2011/05/23 22:00:30 rmind Exp $ */ +/* $NetBSD: filecore_extern.h,v 1.21 2013/06/19 18:16:10 dholland Exp $ */ /*- * Copyright (c) 1994 The Regents of the University of California. @@ -96,10 +96,10 @@ struct filecore_mnt { #define VFSTOFILECORE(mp) ((struct filecore_mnt *)((mp)-mnt_data)) -#define blkoff(fcp, loc) ((loc) ((fcp)-blksize-1)) +#define filecore_blkoff(fcp, loc) ((loc) ((fcp)-blksize-1)) #define lblktosize(fcp, blk) ((blk) (fcp)-log2bsize) #define lblkno(fcp, loc) ((loc) (fcp)-log2bsize) -#define blksize(fcp, ip, lbn) ((fcp)-blksize) +#define filecore_blksize(fcp, ip, lbn) ((fcp)-blksize) extern struct pool filecore_node_pool; Index: src/sys/fs/filecorefs/filecore_vnops.c diff -u src/sys/fs/filecorefs/filecore_vnops.c:1.36 src/sys/fs/filecorefs/filecore_vnops.c:1.37 --- src/sys/fs/filecorefs/filecore_vnops.c:1.36 Mon Mar 18 19:35:36 2013 +++ src/sys/fs/filecorefs/filecore_vnops.c Wed Jun 19 18:16:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_vnops.c,v 1.36 2013/03/18 19:35:36 plunky Exp $ */ +/* $NetBSD: filecore_vnops.c,v 1.37 2013/06/19 18:16:10 dholland Exp $ */ /*- * Copyright (c) 1994 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: filecore_vnops.c,v 1.36 2013/03/18 19:35:36 plunky Exp $); +__KERNEL_RCSID(0, $NetBSD: filecore_vnops.c,v 1.37 2013/06/19 18:16:10 dholland Exp $); #include sys/param.h #include sys/systm.h @@ -240,14 +240,14 @@ filecore_read(void *v) do { lbn = lblkno(fcmp, uio-uio_offset); - on = blkoff(fcmp, uio-uio_offset); - n = MIN(blksize(fcmp, ip, lbn) - on, uio-uio_resid); + on = filecore_blkoff(fcmp, uio-uio_offset); + n = MIN(filecore_blksize(fcmp, ip, lbn) - on, uio-uio_resid); diff = (off_t)ip-i_size - uio-uio_offset; if (diff = 0) return (0); if (diff n) n = diff; - size = blksize(fcmp, ip, lbn); + size = filecore_blksize(fcmp, ip, lbn); rablock = lbn + 1; if (ip-i_dirent.attr FILECORE_ATTR_DIR) { error = filecore_dbread(ip, bp);