Deleted Added
full compact
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

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

181 ncp->nc_nxt = ncq;
182 ncp->nc_prev = &nchhead;
183 return (0);
184}
185
186/*
187 * Add an entry to the cache
188 */
189void
190cache_enter(dvp, vp, cnp)
191 struct vnode *dvp;
192 struct vnode *vp;
193 struct componentname *cnp;
194{
195 register struct namecache *ncp, *ncq, **ncpp;
196
197#ifdef DIAGNOSTIC

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

248 ncp->nc_forw = ncq;
249 ncp->nc_back = ncpp;
250 *ncpp = ncp;
251}
252
253/*
254 * Name cache initialization, from vfs_init() when we are booting
255 */
256void
257nchinit()
258{
259
260 nchtail = &nchhead;
261 nchashtbl = hashinit(desiredvnodes, M_CACHE, &nchash);
262}
263
264/*
265 * Cache flush, a particular vnode; called when a vnode is renamed to
266 * hide entries that would now be invalid
267 */
268void
269cache_purge(vp)
270 struct vnode *vp;
271{
272 struct namecache *ncp, **ncpp;
273
274 vp->v_id = ++nextvnodeid;
275 if (nextvnodeid != 0)
276 return;

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

286/*
287 * Cache flush, a whole filesystem; called when filesys is umounted to
288 * remove entries that would now be invalid
289 *
290 * The line "nxtcp = nchhead" near the end is to avoid potential problems
291 * if the cache lru chain is modified while we are dumping the
292 * inode. This makes the algorithm O(n^2), but do you think I care?
293 */
294void
295cache_purgevfs(mp)
296 struct mount *mp;
297{
298 register struct namecache *ncp, *nxtcp;
299
300 for (ncp = nchhead; ncp; ncp = nxtcp) {
301 if (ncp->nc_dvp == NULL || ncp->nc_dvp->v_mount != mp) {
302 nxtcp = ncp->nc_nxt;

--- 30 unchanged lines hidden ---