| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vfs_dirhash.c,v 1.3 2008/10/30 16:41:18 reinoud Exp $ */ | | 1 | /* $NetBSD: vfs_dirhash.c,v 1.4 2008/10/30 17:19:18 reinoud Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008 Reinoud Zandijk | | 4 | * Copyright (c) 2008 Reinoud Zandijk |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | | 26 | * |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | | | 29 | |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | #ifndef lint | | 31 | #ifndef lint |
32 | __KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.3 2008/10/30 16:41:18 reinoud Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.4 2008/10/30 17:19:18 reinoud Exp $"); |
33 | #endif /* not lint */ | | 33 | #endif /* not lint */ |
34 | | | 34 | |
35 | #if 1 | | 35 | #if 1 |
36 | # define DPRINTF(a) ; | | 36 | # define DPRINTF(a) ; |
37 | #else | | 37 | #else |
38 | # define DPRINTF(a) printf(a); | | 38 | # define DPRINTF(a) printf(a); |
39 | #endif | | 39 | #endif |
40 | | | 40 | |
41 | /* CLEAN UP! */ | | 41 | /* CLEAN UP! */ |
42 | #include <sys/sysctl.h> | | 42 | #include <sys/sysctl.h> |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/sysctl.h> | | 45 | #include <sys/sysctl.h> |
| @@ -63,28 +63,26 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_dirhash. | | | @@ -63,28 +63,26 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_dirhash. |
63 | #include <sys/dirhash.h> | | 63 | #include <sys/dirhash.h> |
64 | | | 64 | |
65 | | | 65 | |
66 | static struct sysctllog *sysctl_log; | | 66 | static struct sysctllog *sysctl_log; |
67 | struct pool dirhash_pool; | | 67 | struct pool dirhash_pool; |
68 | struct pool dirhash_entry_pool; | | 68 | struct pool dirhash_entry_pool; |
69 | | | 69 | |
70 | static kmutex_t dirhashmutex; | | 70 | static kmutex_t dirhashmutex; |
71 | static uint32_t maxdirhashsize = DIRHASH_SIZE; | | 71 | static uint32_t maxdirhashsize = DIRHASH_SIZE; |
72 | static uint32_t dirhashsize = 0; | | 72 | static uint32_t dirhashsize = 0; |
73 | static TAILQ_HEAD(_dirhash, dirhash) dirhash_queue; | | 73 | static TAILQ_HEAD(_dirhash, dirhash) dirhash_queue; |
74 | | | 74 | |
75 | | | 75 | |
76 | #define CURDIRHASHSIZE_SYSCTLOPT 1 | | | |
77 | #define MAXDIRHASHSIZE_SYSCTLOPT 2 | | | |
78 | void | | 76 | void |
79 | dirhash_init(void) | | 77 | dirhash_init(void) |
80 | { | | 78 | { |
81 | const struct sysctlnode *rnode, *cnode; | | 79 | const struct sysctlnode *rnode, *cnode; |
82 | size_t size; | | 80 | size_t size; |
83 | uint32_t max_entries; | | 81 | uint32_t max_entries; |
84 | | | 82 | |
85 | /* initialise dirhash queue */ | | 83 | /* initialise dirhash queue */ |
86 | TAILQ_INIT(&dirhash_queue); | | 84 | TAILQ_INIT(&dirhash_queue); |
87 | | | 85 | |
88 | /* init dirhash pools */ | | 86 | /* init dirhash pools */ |
89 | size = sizeof(struct dirhash); | | 87 | size = sizeof(struct dirhash); |
90 | pool_init(&dirhash_pool, size, 0, 0, 0, | | 88 | pool_init(&dirhash_pool, size, 0, 0, 0, |