Deleted Added
full compact
vfs_cache.c (6951) vfs_cache.c (6952)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94
34 * $Id: vfs_cache.c,v 1.5 1995/03/06 06:45:52 phk Exp $
34 * $Id: vfs_cache.c,v 1.6 1995/03/08 01:08:03 phk Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/time.h>
40#include <sys/mount.h>
41#include <sys/vnode.h>
42#include <sys/namei.h>

--- 64 unchanged lines hidden (view full) ---

107 ncpp = &nchashtbl[(dvp->v_id + cnp->cn_hash) & nchash];
108 for (ncp = ncpp->lh_first; ncp != 0; ncp = nnp) {
109 if (ncp->nc_dvp == dvp &&
110 ncp->nc_dvpid == dvp->v_id &&
111 ncp->nc_nlen == cnp->cn_namelen &&
112 !bcmp(ncp->nc_name, cnp->cn_nameptr, (u_int)ncp->nc_nlen))
113 break;
114 nnp = ncp->nc_hash.le_next;
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/time.h>
40#include <sys/mount.h>
41#include <sys/vnode.h>
42#include <sys/namei.h>

--- 64 unchanged lines hidden (view full) ---

107 ncpp = &nchashtbl[(dvp->v_id + cnp->cn_hash) & nchash];
108 for (ncp = ncpp->lh_first; ncp != 0; ncp = nnp) {
109 if (ncp->nc_dvp == dvp &&
110 ncp->nc_dvpid == dvp->v_id &&
111 ncp->nc_nlen == cnp->cn_namelen &&
112 !bcmp(ncp->nc_name, cnp->cn_nameptr, (u_int)ncp->nc_nlen))
113 break;
114 nnp = ncp->nc_hash.le_next;
115#ifdef not_yet_phk
116 /*
117 * if not already last and one of the vp's are invalid,
118 * move to head of LRU
119 */
120 if ((ncp->nc_lru.tqe_next != 0) &&
121 ( (ncp->nc_dvpid != ncp->nc_dvp->v_id) ||
122 (ncp->nc_vp && (ncp->nc_vpid != ncp->nc_vp->v_id)))) {
115 /* If one of the vp's went stale, don't bother anymore. */
116 if ((ncp->nc_dvpid != ncp->nc_dvp->v_id) ||
117 (ncp->nc_vp && (ncp->nc_vpid != ncp->nc_vp->v_id))) {
123 LIST_REMOVE(ncp, nc_hash);
124 ncp->nc_hash.le_prev = 0;
125 TAILQ_REMOVE(&nclruhead, ncp, nc_lru);
126 TAILQ_INSERT_HEAD(&nclruhead, ncp, nc_lru);
127 }
118 LIST_REMOVE(ncp, nc_hash);
119 ncp->nc_hash.le_prev = 0;
120 TAILQ_REMOVE(&nclruhead, ncp, nc_lru);
121 TAILQ_INSERT_HEAD(&nclruhead, ncp, nc_lru);
122 }
128#endif /* not_yet_phk */
129 }
130 if (ncp == 0) {
131 nchstats.ncs_miss++;
132 return (0);
133 }
134 if ((cnp->cn_flags & MAKEENTRY) == 0) {
135 nchstats.ncs_badhits++;
136 } else if (ncp->nc_vp == NULL) {

--- 15 unchanged lines hidden (view full) ---

152 nchstats.ncs_goodhits++;
153 /*
154 * move this slot to end of LRU chain, if not already there
155 */
156 if (ncp->nc_lru.tqe_next != 0) {
157 TAILQ_REMOVE(&nclruhead, ncp, nc_lru);
158 TAILQ_INSERT_TAIL(&nclruhead, ncp, nc_lru);
159 }
123 }
124 if (ncp == 0) {
125 nchstats.ncs_miss++;
126 return (0);
127 }
128 if ((cnp->cn_flags & MAKEENTRY) == 0) {
129 nchstats.ncs_badhits++;
130 } else if (ncp->nc_vp == NULL) {

--- 15 unchanged lines hidden (view full) ---

146 nchstats.ncs_goodhits++;
147 /*
148 * move this slot to end of LRU chain, if not already there
149 */
150 if (ncp->nc_lru.tqe_next != 0) {
151 TAILQ_REMOVE(&nclruhead, ncp, nc_lru);
152 TAILQ_INSERT_TAIL(&nclruhead, ncp, nc_lru);
153 }
160#ifdef not_yet_phk
161 /* Touch the parent vnode */
162 vtouch(ncp->nc_dvp);
163#endif /* not_yet_phk */
164 *vpp = ncp->nc_vp;
165 return (-1);
166 }
167
168 /*
169 * Last component and we are renaming or deleting,
170 * the cache entry is invalid, or otherwise don't
171 * want cache entry to exist.

--- 124 unchanged lines hidden ---
154 *vpp = ncp->nc_vp;
155 return (-1);
156 }
157
158 /*
159 * Last component and we are renaming or deleting,
160 * the cache entry is invalid, or otherwise don't
161 * want cache entry to exist.

--- 124 unchanged lines hidden ---