Module Name: src Committed By: rmind Date: Sun Jan 22 03:48:51 UTC 2012
Modified Files: src/sys/kern: kern_fileassoc.c Log Message: fileassoc_file_delete: pre-check whether fileassoc was used and thus avoid acquiring kernel-lock, which damages sys_unlink() performance. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_fileassoc.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/kern/kern_fileassoc.c diff -u src/sys/kern/kern_fileassoc.c:1.34 src/sys/kern/kern_fileassoc.c:1.35 --- src/sys/kern/kern_fileassoc.c:1.34 Fri Dec 25 20:07:18 2009 +++ src/sys/kern/kern_fileassoc.c Sun Jan 22 03:48:51 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fileassoc.c,v 1.34 2009/12/25 20:07:18 elad Exp $ */ +/* $NetBSD: kern_fileassoc.c,v 1.35 2012/01/22 03:48:51 rmind Exp $ */ /*- * Copyright (c) 2006 Elad Efrat <e...@netbsd.org> @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_fileassoc.c,v 1.34 2009/12/25 20:07:18 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_fileassoc.c,v 1.35 2012/01/22 03:48:51 rmind Exp $"); #include "opt_fileassoc.h" @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_fileass #define FILEASSOC_INITIAL_TABLESIZE 128 -static specificdata_domain_t fileassoc_domain; +static specificdata_domain_t fileassoc_domain = NULL; static specificdata_key_t fileassoc_mountspecific_key; static ONCE_DECL(control); @@ -510,6 +510,10 @@ fileassoc_file_delete(struct vnode *vp) struct fileassoc_table *tbl; struct fileassoc_file *faf; + /* Pre-check if fileassoc is used. XXX */ + if (!fileassoc_domain) { + return ENOENT; + } KERNEL_LOCK(1, NULL); faf = fileassoc_file_lookup(vp, NULL);