From owner-p4-projects@FreeBSD.ORG Sun Jun 19 09:32:18 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5CA991065677; Sun, 19 Jun 2011 09:32:18 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11AC5106566B for ; Sun, 19 Jun 2011 09:32:18 +0000 (UTC) (envelope-from ilya@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id F2BEB8FC14 for ; Sun, 19 Jun 2011 09:32:17 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p5J9WHrB070346 for ; Sun, 19 Jun 2011 09:32:17 GMT (envelope-from ilya@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p5J9WHwb070343 for perforce@freebsd.org; Sun, 19 Jun 2011 09:32:17 GMT (envelope-from ilya@FreeBSD.org) Date: Sun, 19 Jun 2011 09:32:17 GMT Message-Id: <201106190932.p5J9WHwb070343@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to ilya@FreeBSD.org using -f From: Ilya Putsikau To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 194955 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2011 09:32:18 -0000 http://p4web.freebsd.org/@@194955?ac=10 Change 194955 by ilya@ilya_triton2011 on 2011/06/19 09:31:44 Enable commented sysctls Fix fuse_device_clone rename Add missing isbzero function Affected files ... .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse.h#7 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_file.c#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_internal.c#8 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_ipc.c#4 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_main.c#5 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.c#3 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.h#5 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#14 edit Differences ... ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse.h#7 (text+ko) ==== @@ -225,10 +225,6 @@ void fprettyprint(struct fuse_iov *fiov, size_t dlen); #endif -#if _DEBUG || _DEBUG2G || _DEBUG3G || defined(INVARIANTS) || FUSELIB_CONFORM_BIOREAD -int isbzero(void *buf, size_t len); -#endif - #if _DEBUG || _DEBUG2G || _DEBUG3G #include ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_file.c#3 (text+ko) ==== @@ -29,6 +29,10 @@ #include "fuse_ipc.h" #include "fuse_node.h" +static uint64_t fuse_fh_upcall_count = 0; +SYSCTL_QUAD(_vfs_fuse, OID_AUTO, fh_upcall_count, CTLFLAG_RD, + &fuse_fh_upcall_count, 0, ""); + int fuse_filehandle_get(struct vnode *vp, struct thread *td, struct ucred *cred, fufh_type_t fufh_type) { ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_internal.c#8 (text+ko) ==== @@ -39,9 +39,11 @@ #include "fuse_ipc.h" #include "fuse_node.h" #include "fuse_file.h" -// #include "fuse_nodehash.h" #include "fuse_param.h" -// #include "fuse_sysctl.h" + +#ifdef ZERO_PAD_INCOMPLETE_BUFS +static int isbzero(void *buf, size_t len); +#endif /* access */ @@ -358,7 +360,7 @@ break; } -#if FUSELIB_CONFORM_BIOREAD +#ifdef ZERO_PAD_INCOMPLETE_BUFS if (isbzero(buf, FUSE_NAME_OFFSET)) { err = -1; break; @@ -711,3 +713,19 @@ fuse_insert_callback(fdi.tick, fuse_internal_init_callback); fuse_insert_message(fdi.tick); } + +#ifdef ZERO_PAD_INCOMPLETE_BUFS +static int +isbzero(void *buf, size_t len) +{ + int i; + + for (i = 0; i < len; i++) + { + if (((char *)buf)[i]) + return (0); + } + + return (1); +} +#endif ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_ipc.c#4 (text+ko) ==== @@ -52,9 +52,9 @@ SYSCTL_NODE(_vfs, OID_AUTO, fuse, CTLFLAG_RW, 0, "FUSE tunables"); SYSCTL_STRING(_vfs_fuse, OID_AUTO, fuse4bsd_version, CTLFLAG_RD, FUSE4BSD_VERSION, 0, "fuse4bsd version"); -static int maxfreetickets = 1024; -SYSCTL_INT(_vfs_fuse, OID_AUTO, maxfreetickets, CTLFLAG_RW, - &maxfreetickets, 0, "limit for number of free tickets kept"); +static int fuse_max_freetickets = 1024; +SYSCTL_INT(_vfs_fuse, OID_AUTO, max_freetickets, CTLFLAG_RW, + &fuse_max_freetickets, 0, "limit for number of free tickets kept"); static long fuse_iov_permanent_bufsize = 1 << 19; SYSCTL_LONG(_vfs_fuse, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, &fuse_iov_permanent_bufsize, 0, @@ -121,10 +121,6 @@ fiov_adjust(fiov, 0); } -/* <== fuse_iov methods */ - -/* fuse_ticket methods ==> */ - /* * Tickets are carriers of communication with a fuse daemon. * Tickets have a unique id, which should be kept unique @@ -150,7 +146,6 @@ * cache) */ - static struct fuse_ticket * fticket_alloc(struct fuse_data *data) { @@ -488,8 +483,8 @@ mtx_lock(&tick->tk_data->ticket_mtx); - if (maxfreetickets >= 0 && - maxfreetickets <= tick->tk_data->freeticket_counter) { + if (fuse_max_freetickets >= 0 && + fuse_max_freetickets <= tick->tk_data->freeticket_counter) { die = 1; } else { mtx_unlock(&tick->tk_data->ticket_mtx); @@ -753,12 +748,6 @@ ihead->gid = cred->cr_rgid; } -/******************** - * - * >>> Callback handlers - * - ********************/ - /* * fuse_standard_handler just pulls indata and wakes up pretender. * Doesn't try to interpret data, that's left for the pretender. ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_main.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ #endif -extern void fusedev_clone(void *arg, struct ucred *cred, char *name, +extern void fuse_device_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); extern struct vfsops fuse_vfsops; @@ -86,7 +86,7 @@ #ifdef USE_FUSE_LOCK mtx_init(&fuse_mtx, "fuse_mtx", NULL, MTX_DEF); #endif - eh_tag = EVENTHANDLER_REGISTER(dev_clone, fusedev_clone, 0, + eh_tag = EVENTHANDLER_REGISTER(dev_clone, fuse_device_clone, 0, 1000); if (eh_tag == NULL) { clone_cleanup(&fuseclones); ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.c#3 (text+ko) ==== @@ -34,6 +34,8 @@ #include #include +MALLOC_DEFINE(M_FUSEVN, "fuse_vnode", "fuse vnode private data"); + static void fuse_vnode_init(struct vnode *vp, struct fuse_vnode_data *fvdat, uint64_t nodeid, enum vtype vtyp) ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.h#5 (text+ko) ==== @@ -68,8 +68,6 @@ } } -MALLOC_DECLARE(M_FUSEVN); - struct get_filehandle_param { enum fuse_opcode opcode; uint8_t do_gc:1; ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#14 (text+ko) ==== @@ -105,8 +105,13 @@ .vop_unlock = fuse_vnop_unlock, }; -MALLOC_DEFINE(M_FUSEVN, "fuse_vnode", "fuse vnode private data"); -MALLOC_DEFINE(M_FUSEFH, "fuse_filehandles", "buffer for fuse filehandles"); +static uint64_t fuse_lookup_cache_hits = 0; +SYSCTL_QUAD(_vfs_fuse, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, + &fuse_lookup_cache_hits, 0, ""); + +static uint64_t fuse_lookup_cache_misses = 0; +SYSCTL_QUAD(_vfs_fuse, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, + &fuse_lookup_cache_misses, 0, ""); int fuse_pbuf_freecnt = -1; @@ -650,15 +655,11 @@ switch (err) { case -1: /* positive match */ -#ifdef XXXIP fuse_lookup_cache_hits++; -#endif return 0; case 0: /* no match in cache */ -#ifdef XXXIP fuse_lookup_cache_misses++; -#endif break; case ENOENT: /* negative match */ @@ -1240,13 +1241,12 @@ return EBADF; } -#ifdef XXXIP + /* Sanity check the uio data. */ - if ((uio_iovcnt(uio) > 1) || + if ( /* XXXIP (uio_iovcnt(uio) > 1) || */ (uio_resid(uio) < (int)sizeof(struct dirent))) { return (EINVAL); } -#endif fvdat = VTOFUD(vp); @@ -1363,7 +1363,6 @@ } cache_purge(vp); - /* XXXIP TODO */ vfs_hash_remove(vp); vnode_destroy_vobject(vp); fuse_vnode_destroy(vp); @@ -1620,7 +1619,7 @@ facp.facc_flags &= ~FACCESS_XQUERIES; - if (err && ! (fsai->valid & ~(FATTR_ATIME | FATTR_MTIME)) && + if (err && !(fsai->valid & ~(FATTR_ATIME | FATTR_MTIME)) && vap->va_vaflags & VA_UTIMES_NULL) { err = fuse_internal_access(vp, VWRITE, cred, td, &facp); }