PERFORCE change 195356 for review
Ilya Putsikau
ilya at FreeBSD.org
Sun Jun 26 09:54:29 UTC 2011
http://p4web.freebsd.org/@@195356?ac=10
Change 195356 by ilya at ilya_triton2011 on 2011/06/26 09:54:25
Add filehandle_count and node_count sysctls.
Use atomic operations to increment sysctl values.
Replace uint64_t with long
Affected files ...
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_file.c#9 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.c#9 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#29 edit
Differences ...
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_file.c#9 (text+ko) ====
@@ -32,9 +32,9 @@
#define FUSE_DEBUG_MODULE FILE
#include "fuse_debug.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, "");
+static int fuse_fh_count = 0;
+SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLFLAG_RD,
+ &fuse_fh_count, 0, "");
int
fuse_filehandle_open(struct vnode *vp,
@@ -81,7 +81,6 @@
foi = fdi.indata;
foi->flags = oflags;
- fuse_fh_upcall_count++;
if ((err = fdisp_wait_answ(&fdi))) {
debug_printf("OUCH ... daemon didn't give fh (err = %d)\n", err);
if (err == ENOENT) {
@@ -156,6 +155,7 @@
}
out:
+ atomic_add_acq_int(&fuse_fh_count, -1);
fufh->fh_id = (uint64_t)-1;
fufh->fh_type = FUFH_INVALID;
fuse_invalidate_attr(vp);
@@ -224,4 +224,6 @@
if (fufhp != NULL)
*fufhp = fufh;
+
+ atomic_add_acq_int(&fuse_fh_count, 1);
}
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.c#9 (text+ko) ====
@@ -39,6 +39,10 @@
MALLOC_DEFINE(M_FUSEVN, "fuse_vnode", "fuse vnode private data");
+static int fuse_node_count = 0;
+SYSCTL_INT(_vfs_fuse, OID_AUTO, node_count, CTLFLAG_RD,
+ &fuse_node_count, 0, "");
+
static void
fuse_vnode_init(struct vnode *vp, struct fuse_vnode_data *fvdat,
uint64_t nodeid, enum vtype vtyp)
@@ -59,6 +63,8 @@
for (i = 0; i < FUFH_MAXTYPE; i++)
fvdat->fufh[i].fh_type = FUFH_INVALID;
+
+ atomic_add_acq_int(&fuse_node_count, 1);
}
void
@@ -72,6 +78,8 @@
sx_destroy(&fvdat->nodelock);
sx_destroy(&fvdat->truncatelock);
free(fvdat, M_FUSEVN);
+
+ atomic_add_acq_int(&fuse_node_count, -1);
}
static int
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#29 (text+ko) ====
@@ -114,13 +114,13 @@
.vop_unlock = fuse_vnop_unlock,
};
-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 u_long fuse_lookup_cache_hits = 0;
+SYSCTL_ULONG(_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, "");
+static u_long fuse_lookup_cache_misses = 0;
+SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_misses, CTLFLAG_RD,
+ &fuse_lookup_cache_misses, 0, "");
int fuse_pbuf_freecnt = -1;
@@ -700,11 +700,11 @@
switch (err) {
case -1: /* positive match */
- fuse_lookup_cache_hits++;
+ atomic_add_acq_long(&fuse_lookup_cache_hits, 1);
return 0;
case 0: /* no match in cache */
- fuse_lookup_cache_misses++;
+ atomic_add_acq_long(&fuse_lookup_cache_misses, 1);
break;
case ENOENT: /* negative match */
More information about the p4-projects
mailing list