vfs_cache.c (1542) | vfs_cache.c (1549) |
---|---|
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 */ | 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 |
|
189cache_enter(dvp, vp, cnp) 190 struct vnode *dvp; 191 struct vnode *vp; 192 struct componentname *cnp; 193{ 194 register struct namecache *ncp, *ncq, **ncpp; 195 196#ifdef DIAGNOSTIC --- 50 unchanged lines hidden (view full) --- 247 ncp->nc_forw = ncq; 248 ncp->nc_back = ncpp; 249 *ncpp = ncp; 250} 251 252/* 253 * Name cache initialization, from vfs_init() when we are booting 254 */ | 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 |
|
255nchinit() 256{ 257 258 nchtail = &nchhead; 259 nchashtbl = hashinit(desiredvnodes, M_CACHE, &nchash); 260} 261 262/* 263 * Cache flush, a particular vnode; called when a vnode is renamed to 264 * hide entries that would now be invalid 265 */ | 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 |
|
266cache_purge(vp) 267 struct vnode *vp; 268{ 269 struct namecache *ncp, **ncpp; 270 271 vp->v_id = ++nextvnodeid; 272 if (nextvnodeid != 0) 273 return; --- 9 unchanged lines hidden (view full) --- 283/* 284 * Cache flush, a whole filesystem; called when filesys is umounted to 285 * remove entries that would now be invalid 286 * 287 * The line "nxtcp = nchhead" near the end is to avoid potential problems 288 * if the cache lru chain is modified while we are dumping the 289 * inode. This makes the algorithm O(n^2), but do you think I care? 290 */ | 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 |
|
291cache_purgevfs(mp) 292 struct mount *mp; 293{ 294 register struct namecache *ncp, *nxtcp; 295 296 for (ncp = nchhead; ncp; ncp = nxtcp) { 297 if (ncp->nc_dvp == NULL || ncp->nc_dvp->v_mount != mp) { 298 nxtcp = ncp->nc_nxt; --- 30 unchanged lines hidden --- | 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 --- |