vfs_cache.c (147326) | vfs_cache.c (147331) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Poul-Henning Kamp of the FreeBSD Project. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Poul-Henning Kamp of the FreeBSD Project. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 147326 2005-06-13 00:46:03Z jeff $"); | 36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 147331 2005-06-13 05:59:59Z jeff $"); |
37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/sysctl.h> 44#include <sys/mount.h> --- 231 unchanged lines hidden (view full) --- 276 LIST_REMOVE(ncp, nc_hash); 277 LIST_REMOVE(ncp, nc_src); 278 if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { 279 vp = ncp->nc_dvp; 280 numcachehv--; 281 } 282 if (ncp->nc_vp) { 283 TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); | 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/sysctl.h> 44#include <sys/mount.h> --- 231 unchanged lines hidden (view full) --- 276 LIST_REMOVE(ncp, nc_hash); 277 LIST_REMOVE(ncp, nc_src); 278 if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { 279 vp = ncp->nc_dvp; 280 numcachehv--; 281 } 282 if (ncp->nc_vp) { 283 TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); |
284 ncp->nc_vp->v_dd = NULL; |
|
284 } else { 285 TAILQ_REMOVE(&ncneg, ncp, nc_dst); 286 numneg--; 287 } 288 numcache--; 289 cache_free(ncp); 290 if (vp) 291 vdrop(vp); --- 280 unchanged lines hidden (view full) --- 572 573/* 574 * Invalidate all entries to a particular vnode. 575 */ 576void 577cache_purge(vp) 578 struct vnode *vp; 579{ | 285 } else { 286 TAILQ_REMOVE(&ncneg, ncp, nc_dst); 287 numneg--; 288 } 289 numcache--; 290 cache_free(ncp); 291 if (vp) 292 vdrop(vp); --- 280 unchanged lines hidden (view full) --- 573 574/* 575 * Invalidate all entries to a particular vnode. 576 */ 577void 578cache_purge(vp) 579 struct vnode *vp; 580{ |
580 struct namecache *ncp; | |
581 582 CTR1(KTR_VFS, "cache_purge(%p)", vp); 583 CACHE_LOCK(); | 581 582 CTR1(KTR_VFS, "cache_purge(%p)", vp); 583 CACHE_LOCK(); |
584 while (!LIST_EMPTY(&vp->v_cache_src)) { 585 struct vnode *cvp; 586 587 ncp = LIST_FIRST(&vp->v_cache_src); 588 /* 589 * We must reset v_dd of any children so they don't 590 * continue to point to us. 591 */ 592 if ((cvp = ncp->nc_vp) && cvp->v_dd == vp) 593 cvp->v_dd = NULL; 594 cache_zap(ncp); 595 } | 584 while (!LIST_EMPTY(&vp->v_cache_src)) 585 cache_zap(LIST_FIRST(&vp->v_cache_src)); |
596 while (!TAILQ_EMPTY(&vp->v_cache_dst)) 597 cache_zap(TAILQ_FIRST(&vp->v_cache_dst)); 598 vp->v_dd = NULL; 599 CACHE_UNLOCK(); 600} 601 602/* 603 * Flush all entries referencing a particular filesystem. --- 272 unchanged lines hidden --- | 586 while (!TAILQ_EMPTY(&vp->v_cache_dst)) 587 cache_zap(TAILQ_FIRST(&vp->v_cache_dst)); 588 vp->v_dd = NULL; 589 CACHE_UNLOCK(); 590} 591 592/* 593 * Flush all entries referencing a particular filesystem. --- 272 unchanged lines hidden --- |