fileassoc_file_delete: pre-check whether fileassoc was used and thus avoid

acquiring kernel-lock, which damages sys_unlink() performance.
This commit is contained in:
rmind 2012-01-22 03:48:51 +00:00
parent 0adcb88bc3
commit 5d8ea36772
1 changed files with 7 additions and 3 deletions

View File

@ -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 <elad@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_fileassoc.c,v 1.34 2009/12/25 20:07:18 elad Exp
#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);