Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern fileassoc_file_delete: pre-check whether fileassoc ...



details:   https://anonhg.NetBSD.org/src/rev/2b9d282219ba
branches:  trunk
changeset: 772940:2b9d282219ba
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sun Jan 22 03:48:51 2012 +0000

description:
fileassoc_file_delete: pre-check whether fileassoc was used and thus avoid
acquiring kernel-lock, which damages sys_unlink() performance.

diffstat:

 sys/kern/kern_fileassoc.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 03e148930ecd -r 2b9d282219ba sys/kern/kern_fileassoc.c
--- a/sys/kern/kern_fileassoc.c Sun Jan 22 03:13:19 2012 +0000
+++ b/sys/kern/kern_fileassoc.c Sun Jan 22 03:48:51 2012 +0000
@@ -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@localhost>
@@ -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 @@
 
 #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 @@
        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);



Home | Main Index | Thread Index | Old Index