| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vfs_cache.c,v 1.79 2008/10/25 14:18:18 yamt Exp $ */ | | 1 | /* $NetBSD: vfs_cache.c,v 1.80 2008/10/25 14:20:17 yamt Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
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. |
| @@ -48,27 +48,27 @@ | | | @@ -48,27 +48,27 @@ |
48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
55 | * SUCH DAMAGE. | | 55 | * SUCH DAMAGE. |
56 | * | | 56 | * |
57 | * @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94 | | 57 | * @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94 |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #include <sys/cdefs.h> | | 60 | #include <sys/cdefs.h> |
61 | __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.79 2008/10/25 14:18:18 yamt Exp $"); | | 61 | __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.80 2008/10/25 14:20:17 yamt Exp $"); |
62 | | | 62 | |
63 | #include "opt_ddb.h" | | 63 | #include "opt_ddb.h" |
64 | #include "opt_revcache.h" | | 64 | #include "opt_revcache.h" |
65 | | | 65 | |
66 | #include <sys/param.h> | | 66 | #include <sys/param.h> |
67 | #include <sys/systm.h> | | 67 | #include <sys/systm.h> |
68 | #include <sys/time.h> | | 68 | #include <sys/time.h> |
69 | #include <sys/mount.h> | | 69 | #include <sys/mount.h> |
70 | #include <sys/vnode.h> | | 70 | #include <sys/vnode.h> |
71 | #include <sys/namei.h> | | 71 | #include <sys/namei.h> |
72 | #include <sys/errno.h> | | 72 | #include <sys/errno.h> |
73 | #include <sys/pool.h> | | 73 | #include <sys/pool.h> |
74 | #include <sys/mutex.h> | | 74 | #include <sys/mutex.h> |
| @@ -474,26 +474,28 @@ cache_lookup_raw(struct vnode *dvp, stru | | | @@ -474,26 +474,28 @@ cache_lookup_raw(struct vnode *dvp, stru |
474 | error = vget(vp, LK_NOWAIT | LK_INTERLOCK); | | 474 | error = vget(vp, LK_NOWAIT | LK_INTERLOCK); |
475 | if (error) { | | 475 | if (error) { |
476 | KASSERT(error == EBUSY); | | 476 | KASSERT(error == EBUSY); |
477 | /* | | 477 | /* |
478 | * This vnode is being cleaned out. | | 478 | * This vnode is being cleaned out. |
479 | * XXX badhits? | | 479 | * XXX badhits? |
480 | */ | | 480 | */ |
481 | COUNT(cpup->cpu_stats, ncs_falsehits); | | 481 | COUNT(cpup->cpu_stats, ncs_falsehits); |
482 | *vpp = NULL; | | 482 | *vpp = NULL; |
483 | return -1; | | 483 | return -1; |
484 | } | | 484 | } |
485 | } | | 485 | } |
486 | | | 486 | |
| | | 487 | /* Unlocked, but only for stats. */ |
| | | 488 | COUNT(cpup->cpu_stats, ncs_goodhits); /* XXX can be "badhits" */ |
487 | *vpp = vp; | | 489 | *vpp = vp; |
488 | return 0; | | 490 | return 0; |
489 | } | | 491 | } |
490 | | | 492 | |
491 | /* | | 493 | /* |
492 | * Scan cache looking for name of directory entry pointing at vp. | | 494 | * Scan cache looking for name of directory entry pointing at vp. |
493 | * | | 495 | * |
494 | * Fill in dvpp. | | 496 | * Fill in dvpp. |
495 | * | | 497 | * |
496 | * If bufp is non-NULL, also place the name in the buffer which starts | | 498 | * If bufp is non-NULL, also place the name in the buffer which starts |
497 | * at bufp, immediately before *bpp, and move bpp backwards to point | | 499 | * at bufp, immediately before *bpp, and move bpp backwards to point |
498 | * at the start of it. (Yes, this is a little baroque, but it's done | | 500 | * at the start of it. (Yes, this is a little baroque, but it's done |
499 | * this way to cater to the whims of getcwd). | | 501 | * this way to cater to the whims of getcwd). |