Deleted Added
full compact
vfs_cache.c (190942) vfs_cache.c (190945)
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 190942 2009-04-11 16:12:20Z kib $");
36__FBSDID("$FreeBSD: head/sys/kern/vfs_cache.c 190945 2009-04-11 20:23:08Z kan $");
37
38#include "opt_kdtrace.h"
39#include "opt_ktrace.h"
40
41#include <sys/param.h>
42#include <sys/filedesc.h>
43#include <sys/fnv_hash.h>
44#include <sys/kernel.h>

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

673 n2->nc_nlen == cnp->cn_namelen &&
674 !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) {
675 CACHE_WUNLOCK();
676 cache_free(ncp);
677 return;
678 }
679 }
680
37
38#include "opt_kdtrace.h"
39#include "opt_ktrace.h"
40
41#include <sys/param.h>
42#include <sys/filedesc.h>
43#include <sys/fnv_hash.h>
44#include <sys/kernel.h>

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

673 n2->nc_nlen == cnp->cn_namelen &&
674 !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) {
675 CACHE_WUNLOCK();
676 cache_free(ncp);
677 return;
678 }
679 }
680
681 /*
682 * See if we are trying to add .. entry, but some other lookup
683 * has populated v_cache_dd pointer already.
684 */
685 if (flag == NCF_ISDOTDOT && dvp->v_cache_dd != NULL) {
686 CACHE_WUNLOCK();
687 cache_free(ncp);
688 return;
681 if (flag == NCF_ISDOTDOT) {
682 /*
683 * See if we are trying to add .. entry, but some other lookup
684 * has populated v_cache_dd pointer already.
685 */
686 if (dvp->v_cache_dd != NULL) {
687 CACHE_WUNLOCK();
688 cache_free(ncp);
689 return;
690 }
691 KASSERT(vp == NULL || vp->v_type == VDIR,
692 ("wrong vnode type %p", vp));
693 dvp->v_cache_dd = ncp;
689 }
690
691 numcache++;
692 if (!vp) {
693 numneg++;
694 if (cnp->cn_flags & ISWHITEOUT)
695 ncp->nc_flag |= NCF_WHITE;
696 } else if (vp->v_type == VDIR) {
694 }
695
696 numcache++;
697 if (!vp) {
698 numneg++;
699 if (cnp->cn_flags & ISWHITEOUT)
700 ncp->nc_flag |= NCF_WHITE;
701 } else if (vp->v_type == VDIR) {
697 if (flag == NCF_ISDOTDOT) {
698 KASSERT(dvp->v_cache_dd == NULL,
699 ("dangling v_cache_dd"));
700 dvp->v_cache_dd = ncp;
701 } else {
702 if (flag != NCF_ISDOTDOT) {
702 if ((n2 = vp->v_cache_dd) != NULL &&
703 (n2->nc_flag & NCF_ISDOTDOT) != 0)
704 cache_zap(n2);
705 vp->v_cache_dd = ncp;
706 }
707 } else {
708 vp->v_cache_dd = NULL;
709 }

--- 503 unchanged lines hidden ---
703 if ((n2 = vp->v_cache_dd) != NULL &&
704 (n2->nc_flag & NCF_ISDOTDOT) != 0)
705 cache_zap(n2);
706 vp->v_cache_dd = ncp;
707 }
708 } else {
709 vp->v_cache_dd = NULL;
710 }

--- 503 unchanged lines hidden ---