diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2008-01-22 00:32:53 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2008-01-22 00:32:53 +0000 |
| commit | 9fd8c5def19c2a19fd2cf9d98a38e11a14f1e59a (patch) | |
| tree | 86a714e8437846fc47dbd73bbb5bad51c590c2d7 | |
| parent | ef807c589ee09cbc574af8cddf111631eaa13ec9 (diff) | |
Notes
| -rw-r--r-- | sys/fs/coda/cnode.h | 6 | ||||
| -rw-r--r-- | sys/fs/coda/coda_namecache.h | 42 | ||||
| -rw-r--r-- | sys/fs/coda/coda_psdev.c | 3 | ||||
| -rw-r--r-- | sys/fs/coda/coda_vfsops.c | 17 | ||||
| -rw-r--r-- | sys/fs/coda/coda_vnops.c | 38 |
5 files changed, 41 insertions, 65 deletions
diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h index c747170ced95..297d53895308 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/coda/cnode.h @@ -74,15 +74,9 @@ do { \ #define CODA_FREE(ptr, size) free((ptr), M_CODA) /* - * global cache state control - */ -extern int coda_nc_use; - -/* * Used to select debugging statements throughout the cfs code. */ extern int codadebug; -extern int coda_nc_debug; extern int coda_printf_delay; extern int coda_vnop_print_entry; extern int coda_psdev_print_entry; diff --git a/sys/fs/coda/coda_namecache.h b/sys/fs/coda/coda_namecache.h index 77f2cb168255..637a0d02bc46 100644 --- a/sys/fs/coda/coda_namecache.h +++ b/sys/fs/coda/coda_namecache.h @@ -63,13 +63,8 @@ * 2nd try -- same, except dir fid.vnode instead of cp */ -#ifdef oldhash -#define CODA_NC_HASH(name, namelen, cp) \ - ((name[0] + name[namelen-1] + namelen + (int)(intptr_t)(cp)) & (coda_nc_hashsize-1)) -#else #define CODA_NC_HASH(name, namelen, cp) \ ((name[0] + (name[namelen-1]<<4) + namelen + (((int)(intptr_t)cp)>>8)) & (coda_nc_hashsize-1)) -#endif #define CODA_NAMEMATCH(cp, name, namelen, dcp) \ ((namelen == cp->namelen) && (dcp == cp->dcp) && \ @@ -136,21 +131,28 @@ struct coda_hash { /* Start of Hash chain */ #define CODA_NC_DEBUG(N, STMT) { if (coda_nc_debug & (1 <<N)) { STMT } } /* Prototypes of functions exported within cfs */ -extern void coda_nc_init(void); -extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *); -extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *); - -extern void coda_nc_zapParentfid(CodaFid *, enum dc_status); -extern void coda_nc_zapfid(CodaFid *, enum dc_status); -extern void coda_nc_zapvnode(CodaFid *, struct ucred *, enum dc_status); -extern void coda_nc_zapfile(struct cnode *, const char *, int); -extern void coda_nc_purge_user(uid_t, enum dc_status); -extern void coda_nc_flush(enum dc_status); - -extern void print_coda_nc(void); -extern void coda_nc_gather_stats(void); -extern int coda_nc_resize(int, int, enum dc_status); -extern void coda_nc_name(struct cnode *cp); +void coda_nc_init(void); +void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *); +struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *); + +void coda_nc_zapParentfid(CodaFid *, enum dc_status); +void coda_nc_zapfid(CodaFid *, enum dc_status); +void coda_nc_zapvnode(CodaFid *, struct ucred *, enum dc_status); +void coda_nc_zapfile(struct cnode *, const char *, int); +void coda_nc_purge_user(uid_t, enum dc_status); +void coda_nc_flush(enum dc_status); + +void print_coda_nc(void); +void coda_nc_gather_stats(void); +int coda_nc_resize(int, int, enum dc_status); +void coda_nc_name(struct cnode *cp); + +/* + * Global variables tracking and controlling Coda namecache operation. + */ +extern int coda_nc_debug; /* Set to enable debugging printfs */ +extern int coda_nc_initialized; /* Set if cache has been initialized */ +extern int coda_nc_use; /* Indicate use of CODA Name Cache */ /* * Structure to contain statistics on the cache usage diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 32123ecb0b43..0321bb1f9c39 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/coda/coda_psdev.c @@ -51,9 +51,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); - -extern int coda_nc_initialized; /* Set if cache has been initialized */ - #include <sys/param.h> #include <sys/systm.h> #include <sys/ioccom.h> diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 8bbf0240d798..bd3d33c37278 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -77,9 +77,6 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; #define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++) #define MARK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) -extern int coda_nc_initialized; /* Set if cache has been initialized */ -extern int vc_nb_open(struct cdev *, int, int, struct thread *); - int coda_vfsopstats_init(void) { @@ -168,7 +165,7 @@ coda_mount(struct mount *vfsp, struct thread *td) } /* No initialization (here) of mi_vcomm! */ - vfsp->mnt_data = (qaddr_t)mi; + vfsp->mnt_data = mi; vfs_getnewfsid (vfsp); mi->mi_vfsp = vfsp; @@ -227,10 +224,10 @@ coda_unmount(vfsp, mntflags, td) printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); #endif vrele(mi->mi_rootvp); + mi->mi_rootvp = NULL; vrele(coda_ctlvp); + coda_ctlvp = NULL; active = coda_kill(vfsp, NOT_DOWNCALL); - ASSERT_VOP_LOCKED(mi->mi_rootvp, "coda_unmount"); - mi->mi_rootvp->v_vflag &= ~VV_ROOT; error = vflush(mi->mi_vfsp, 0, FORCECLOSE, td); #ifdef CODA_VERBOSE printf("coda_unmount: active = %d, vflush active %d\n", active, error); @@ -243,7 +240,6 @@ coda_unmount(vfsp, mntflags, td) /* No more vfsp's to hold onto */ mi->mi_vfsp = NULL; - mi->mi_rootvp = NULL; if (error) MARK_INT_FAIL(CODA_UMOUNT_STATS); @@ -375,13 +371,11 @@ coda_nb_statfs(vfsp, sbp, td) return(EINVAL); } - bzero(sbp, sizeof(struct statfs)); /* XXX - what to do about f_flags, others? --bnoble */ /* Below This is what AFS does #define NB_SFS_SIZ 0x895440 */ - /* Note: Normal fs's have a bsize of 0x400 == 1024 */ - sbp->f_type = vfsp->mnt_vfc->vfc_typenum; + sbp->f_flags = 0; sbp->f_bsize = 8192; /* XXX */ sbp->f_iosize = 8192; /* XXX */ #define NB_SFS_SIZ 0x8AB75D @@ -390,9 +384,6 @@ coda_nb_statfs(vfsp, sbp, td) sbp->f_bavail = NB_SFS_SIZ; sbp->f_files = NB_SFS_SIZ; sbp->f_ffree = NB_SFS_SIZ; - bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t)); - snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), "/coda"); - snprintf(sbp->f_fstypename, sizeof(sbp->f_fstypename), "coda"); /* MARK_INT_SAT(CODA_STATFS_STATS); */ return(0); } diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 19d31a69e82e..4d7e6df8abf9 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -106,10 +106,9 @@ static int coda_lockdebug = 0; /* Definition of the vnode operation vector */ struct vop_vector coda_vnodeops = { - .vop_default = VOP_PANIC, + .vop_default = &default_vnodeops, .vop_lookup = coda_lookup, /* lookup */ .vop_create = coda_create, /* create */ - .vop_mknod = VOP_PANIC, /* mknod */ .vop_open = coda_open, /* open */ .vop_close = coda_close, /* close */ .vop_access = coda_access, /* access */ @@ -132,11 +131,9 @@ struct vop_vector coda_vnodeops = { .vop_lock1 = coda_lock, /* lock */ .vop_unlock = coda_unlock, /* unlock */ .vop_bmap = coda_bmap, /* bmap */ - .vop_print = VOP_PANIC, /* print */ + .vop_print = VOP_NULL, /* print */ .vop_islocked = coda_islocked, /* islocked */ .vop_pathconf = coda_pathconf, /* pathconf */ - .vop_advlock = VOP_NULL, /* advlock */ - .vop_lease = VOP_NULL, /* lease */ .vop_poll = vop_stdpoll, .vop_getpages = vop_stdgetpages, /* pager intf.*/ .vop_putpages = vop_stdputpages, /* pager intf.*/ @@ -221,9 +218,6 @@ coda_open(struct vop_open_args *ap) CODADEBUG( CODA_OPEN,myprintf(("open: vp %p result %d\n", vp, error));) - /* Keep a reference until the close comes in. */ - vref(*vpp); - /* Save the vnode pointer for the cache file. */ if (cp->c_ovp == NULL) { cp->c_ovp = vp; @@ -244,6 +238,8 @@ coda_open(struct vop_open_args *ap) if (error) { printf("coda_open: VOP_OPEN on container failed %d\n", error); return (error); + } else { + (*vpp)->v_object = vp->v_object; } /* grab (above) does this when it calls newvnode unless it's in the cache*/ @@ -291,8 +287,6 @@ coda_close(struct vop_close_args *ap) error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, td->td_proc); else error = ENODEV; - vrele(vp); - CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); ) return(error); } @@ -347,7 +341,9 @@ coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, opened_internally = 1; MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, td, NULL); +#ifdef CODA_VERBOSE printf("coda_rdwr: Internally Opening %p\n", vp); +#endif if (error) { printf("coda_rdwr: VOP_OPEN on container failed %d\n", error); return (error); @@ -747,6 +743,8 @@ coda_inactive(struct vop_inactive_args *ap) CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %s, vfsp %p\n", coda_f2s(&cp->c_fid), vp->v_mount));) + + vp->v_object = NULL; /* If an array has been allocated to hold the symlink, deallocate it */ if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { @@ -930,19 +928,14 @@ coda_lookup(struct vop_lookup_args *ap) * lock it without bothering to check anything else. */ if (*ap->a_vpp) { - if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) { - vn_lock(dvp, LK_RETRY|LK_EXCLUSIVE, td); - return (error); - } + vn_lock(*ap->a_vpp, LK_EXCLUSIVE | LK_RETRY, td); } vn_lock(dvp, LK_RETRY|LK_EXCLUSIVE, td); } else { /* The parent is locked, and may be the same as the child */ if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ - if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) { - return (error); - } + vn_lock(*ap->a_vpp, LK_EXCLUSIVE | LK_RETRY, td); } } } else { @@ -1026,10 +1019,7 @@ coda_create(struct vop_create_args *ap) if (!error) { if (cnp->cn_flags & LOCKLEAF) { - if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) { - printf("coda_create: "); - panic("unlocked parent but couldn't lock child"); - } + vn_lock(*ap->a_vpp, LK_EXCLUSIVE | LK_RETRY, td); } #ifdef OLD_DIAGNOSTIC else { @@ -1292,7 +1282,9 @@ coda_mkdir(struct vop_mkdir_args *ap) /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(dvp)->c_flags &= ~C_VATTR; - + + vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td); + CODADEBUG( CODA_MKDIR, myprintf(("mkdir: %s result %d\n", coda_f2s(&VFid), error)); ) } else { @@ -1552,7 +1544,7 @@ coda_reclaim(struct vop_reclaim_args *ap) cache_purge(vp); coda_free(VTOC(vp)); vp->v_data = NULL; - vnode_destroy_vobject(vp); + vp->v_object = NULL; return (0); } |
