Lines Matching refs:ncp

377 cache_remove(struct namecache *ncp, const bool dir2node)
379 struct vnode *vp, *dvp = ncp->nc_dvp;
381 size_t namelen = NC_NLEN(ncp);
384 KASSERT(cache_key(ncp->nc_name, namelen) == ncp->nc_key);
385 KASSERT(rb_tree_find_node(&dvi->vi_nc_tree, ncp) == ncp);
387 SDT_PROBE(vfs, namecache, invalidate, done, ncp, 0, 0, 0, 0);
393 if ((vp = ncp->nc_vp) != NULL) {
397 TAILQ_REMOVE(&vi->vi_nc_list, ncp, nc_list);
400 TAILQ_REMOVE(&vi->vi_nc_list, ncp, nc_list);
405 rb_tree_remove_node(&dvi->vi_nc_tree, ncp);
409 TAILQ_REMOVE(&cache_lru.list[ncp->nc_lrulist], ncp, nc_lru);
410 cache_lru.count[ncp->nc_lrulist]--;
416 kmem_free(ncp, sz);
418 pool_cache_put(cache_pool, ncp);
431 struct namecache *ncp;
451 ncp = (struct namecache *)node;
452 KASSERT((void *)&ncp->nc_tree == (void *)ncp);
453 KASSERT(ncp->nc_dvp == dvp);
454 if (ncp->nc_key == key) {
455 KASSERT(NC_NLEN(ncp) == namelen);
456 diff = memcmp(ncp->nc_name, name, namelen);
462 node = node->rb_nodes[ncp->nc_key < key];
471 lrulist = atomic_load_relaxed(&ncp->nc_lrulist);
473 cache_activate(ncp);
475 return ncp;
534 struct namecache *ncp;
569 ncp = cache_lookup_entry(dvp, name, namelen, key);
570 if (__predict_false(ncp == NULL)) {
584 cache_remove(ncp, true);
589 if ((vp = ncp->nc_vp) == NULL) {
594 *iswht_ret = ncp->nc_whiteout;
596 KASSERT(!ncp->nc_whiteout);
605 cache_remove(ncp, true);
660 struct namecache *ncp;
742 ncp = cache_lookup_entry(dvp, name, namelen, key);
743 if (__predict_false(ncp == NULL)) {
752 if ((vp = ncp->nc_vp) == NULL) {
796 struct namecache *ncp;
835 TAILQ_FOREACH(ncp, &vi->vi_nc_list, nc_list) {
836 KASSERT(ncp->nc_vp == vp);
837 KASSERT(ncp->nc_dvp != NULL);
838 nlen = NC_NLEN(ncp);
851 if (ncp->nc_name[0] == '.') {
853 (nlen == 2 && ncp->nc_name[1] == '.')) {
862 lrulist = atomic_load_relaxed(&ncp->nc_lrulist);
864 cache_activate(ncp);
877 memcpy(bp, ncp->nc_name, nlen);
881 dvp = ncp->nc_dvp;
914 struct namecache *ncp, *oncp;
942 ncp = pool_cache_get(cache_pool, PR_WAITOK);
945 ncp = kmem_alloc(sz, KM_SLEEP);
952 ncp->nc_vp = vp;
953 ncp->nc_dvp = dvp;
954 ncp->nc_key = cache_key(name, namelen);
955 ncp->nc_whiteout = ((cnflags & ISWHITEOUT) != 0);
956 memcpy(ncp->nc_name, name, namelen);
963 oncp = rb_tree_insert_node(&dvi->vi_nc_tree, ncp);
964 if (oncp != ncp) {
965 KASSERT(oncp->nc_key == ncp->nc_key);
966 KASSERT(NC_NLEN(oncp) == NC_NLEN(ncp));
969 oncp = rb_tree_insert_node(&dvi->vi_nc_tree, ncp);
970 KASSERT(oncp == ncp);
979 ncp->nc_lrulist = LRU_ACTIVE;
981 TAILQ_INSERT_TAIL(&cache_lru.list[LRU_ACTIVE], ncp, nc_lru);
996 TAILQ_INSERT_TAIL(&vi->vi_nc_list, ncp, nc_list);
998 TAILQ_INSERT_HEAD(&vi->vi_nc_list, ncp, nc_list);
1179 struct namecache *ncp;
1186 while ((ncp = TAILQ_FIRST(&vi->vi_nc_list)) != NULL) {
1192 dvp = ncp->nc_dvp;
1195 cache_remove(ncp, false);
1236 struct namecache *ncp;
1241 while ((ncp = RB_TREE_MIN(&dvi->vi_nc_tree)) != NULL) {
1242 cache_remove(ncp, true);
1255 struct namecache *ncp;
1262 ncp = cache_lookup_entry(dvp, name, namelen, key);
1263 if (ncp) {
1264 cache_remove(ncp, true);
1325 cache_activate(struct namecache *ncp)
1329 TAILQ_REMOVE(&cache_lru.list[ncp->nc_lrulist], ncp, nc_lru);
1330 TAILQ_INSERT_TAIL(&cache_lru.list[LRU_ACTIVE], ncp, nc_lru);
1331 cache_lru.count[ncp->nc_lrulist]--;
1333 ncp->nc_lrulist = LRU_ACTIVE;
1344 struct namecache *ncp;
1367 ncp = TAILQ_FIRST(&cache_lru.list[LRU_ACTIVE]);
1368 if (ncp == NULL) {
1371 KASSERT(ncp->nc_lrulist == LRU_ACTIVE);
1372 ncp->nc_lrulist = LRU_INACTIVE;
1373 TAILQ_REMOVE(&cache_lru.list[LRU_ACTIVE], ncp, nc_lru);
1374 TAILQ_INSERT_TAIL(&cache_lru.list[LRU_INACTIVE], ncp, nc_lru);
1392 struct namecache *ncp;
1413 ncp = TAILQ_FIRST(&cache_lru.list[LRU_INACTIVE]);
1414 if (ncp == NULL) {
1417 dvi = VNODE_TO_VIMPL(ncp->nc_dvp);
1418 KASSERT(ncp->nc_lrulist == LRU_INACTIVE);
1429 ncp, nc_lru);
1431 ncp, nc_lru);
1443 cache_remove(ncp, true);
1542 struct namecache *ncp;
1546 TAILQ_FOREACH(ncp, &cache_lru.list[id], nc_lru) {
1547 if (ncp->nc_vp == vp) {
1548 (*pr)("name %.*s\n", NC_NLEN(ncp),
1549 ncp->nc_name);
1550 dvp = ncp->nc_dvp;
1559 TAILQ_FOREACH(ncp, &cache_lru.list[id], nc_lru) {
1560 if (ncp->nc_vp == dvp) {
1561 (*pr)("parent %.*s\n", NC_NLEN(ncp),
1562 ncp->nc_name);