Lines Matching defs:ncp
379 cache_remove(struct namecache *ncp, const bool dir2node)
381 struct vnode *vp, *dvp = ncp->nc_dvp;
383 size_t namelen = NC_NLEN(ncp);
386 KASSERT(cache_key(ncp->nc_name, namelen) == ncp->nc_key);
387 KASSERT(rb_tree_find_node(&dvi->vi_nc_tree, ncp) == ncp);
389 SDT_PROBE(vfs, namecache, invalidate, done, ncp, 0, 0, 0, 0);
395 if ((vp = ncp->nc_vp) != NULL) {
399 TAILQ_REMOVE(&vi->vi_nc_list, ncp, nc_list);
402 TAILQ_REMOVE(&vi->vi_nc_list, ncp, nc_list);
407 rb_tree_remove_node(&dvi->vi_nc_tree, ncp);
411 TAILQ_REMOVE(&cache_lru.list[ncp->nc_lrulist], ncp, nc_lru);
412 cache_lru.count[ncp->nc_lrulist]--;
418 kmem_free(ncp, sz);
420 pool_cache_put(cache_pool, ncp);
433 struct namecache *ncp;
453 ncp = (struct namecache *)node;
454 KASSERT((void *)&ncp->nc_tree == (void *)ncp);
455 KASSERT(ncp->nc_dvp == dvp);
456 if (ncp->nc_key == key) {
457 KASSERT(NC_NLEN(ncp) == namelen);
458 diff = memcmp(ncp->nc_name, name, namelen);
464 node = node->rb_nodes[ncp->nc_key < key];
473 lrulist = atomic_load_relaxed(&ncp->nc_lrulist);
475 cache_activate(ncp);
477 return ncp;
536 struct namecache *ncp;
571 ncp = cache_lookup_entry(dvp, name, namelen, key);
572 if (__predict_false(ncp == NULL)) {
586 cache_remove(ncp, true);
591 if ((vp = ncp->nc_vp) == NULL) {
596 *iswht_ret = ncp->nc_whiteout;
598 KASSERT(!ncp->nc_whiteout);
607 cache_remove(ncp, true);
662 struct namecache *ncp;
745 ncp = cache_lookup_entry(dvp, name, namelen, key);
746 if (__predict_false(ncp == NULL)) {
755 if ((vp = ncp->nc_vp) == NULL) {
799 struct namecache *ncp;
840 TAILQ_FOREACH(ncp, &vi->vi_nc_list, nc_list) {
841 KASSERT(ncp->nc_vp == vp);
842 KASSERT(ncp->nc_dvp != NULL);
843 nlen = NC_NLEN(ncp);
856 if (ncp->nc_name[0] == '.') {
858 (nlen == 2 && ncp->nc_name[1] == '.')) {
867 lrulist = atomic_load_relaxed(&ncp->nc_lrulist);
869 cache_activate(ncp);
882 memcpy(bp, ncp->nc_name, nlen);
886 dvp = ncp->nc_dvp;
919 struct namecache *ncp, *oncp;
947 ncp = pool_cache_get(cache_pool, PR_WAITOK);
950 ncp = kmem_alloc(sz, KM_SLEEP);
957 ncp->nc_vp = vp;
958 ncp->nc_dvp = dvp;
959 ncp->nc_key = cache_key(name, namelen);
960 ncp->nc_whiteout = ((cnflags & ISWHITEOUT) != 0);
961 memcpy(ncp->nc_name, name, namelen);
968 oncp = rb_tree_insert_node(&dvi->vi_nc_tree, ncp);
969 if (oncp != ncp) {
970 KASSERT(oncp->nc_key == ncp->nc_key);
971 KASSERT(NC_NLEN(oncp) == NC_NLEN(ncp));
974 oncp = rb_tree_insert_node(&dvi->vi_nc_tree, ncp);
975 KASSERT(oncp == ncp);
984 ncp->nc_lrulist = LRU_ACTIVE;
986 TAILQ_INSERT_TAIL(&cache_lru.list[LRU_ACTIVE], ncp, nc_lru);
1001 TAILQ_INSERT_TAIL(&vi->vi_nc_list, ncp, nc_list);
1003 TAILQ_INSERT_HEAD(&vi->vi_nc_list, ncp, nc_list);
1184 struct namecache *ncp;
1191 while ((ncp = TAILQ_FIRST(&vi->vi_nc_list)) != NULL) {
1197 dvp = ncp->nc_dvp;
1200 cache_remove(ncp, false);
1241 struct namecache *ncp;
1246 while ((ncp = RB_TREE_MIN(&dvi->vi_nc_tree)) != NULL) {
1247 cache_remove(ncp, true);
1260 struct namecache *ncp;
1267 ncp = cache_lookup_entry(dvp, name, namelen, key);
1268 if (ncp) {
1269 cache_remove(ncp, true);
1330 cache_activate(struct namecache *ncp)
1334 TAILQ_REMOVE(&cache_lru.list[ncp->nc_lrulist], ncp, nc_lru);
1335 TAILQ_INSERT_TAIL(&cache_lru.list[LRU_ACTIVE], ncp, nc_lru);
1336 cache_lru.count[ncp->nc_lrulist]--;
1338 ncp->nc_lrulist = LRU_ACTIVE;
1349 struct namecache *ncp;
1372 ncp = TAILQ_FIRST(&cache_lru.list[LRU_ACTIVE]);
1373 if (ncp == NULL) {
1376 KASSERT(ncp->nc_lrulist == LRU_ACTIVE);
1377 ncp->nc_lrulist = LRU_INACTIVE;
1378 TAILQ_REMOVE(&cache_lru.list[LRU_ACTIVE], ncp, nc_lru);
1379 TAILQ_INSERT_TAIL(&cache_lru.list[LRU_INACTIVE], ncp, nc_lru);
1397 struct namecache *ncp;
1418 ncp = TAILQ_FIRST(&cache_lru.list[LRU_INACTIVE]);
1419 if (ncp == NULL) {
1422 dvi = VNODE_TO_VIMPL(ncp->nc_dvp);
1423 KASSERT(ncp->nc_lrulist == LRU_INACTIVE);
1434 ncp, nc_lru);
1436 ncp, nc_lru);
1448 cache_remove(ncp, true);
1547 struct namecache *ncp;
1551 TAILQ_FOREACH(ncp, &cache_lru.list[id], nc_lru) {
1552 if (ncp->nc_vp == vp) {
1553 (*pr)("name %.*s\n", NC_NLEN(ncp),
1554 ncp->nc_name);
1555 dvp = ncp->nc_dvp;
1564 TAILQ_FOREACH(ncp, &cache_lru.list[id], nc_lru) {
1565 if (ncp->nc_vp == dvp) {
1566 (*pr)("parent %.*s\n", NC_NLEN(ncp),
1567 ncp->nc_name);