* Add an entry to the cache. */
| 2278 | * Add an entry to the cache. |
| 2279 | */ |
| 2280 | void |
| 2281 | cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, |
| 2282 | struct timespec *tsp, struct timespec *dtsp) |
| 2283 | { |
| 2284 | struct celockstate cel; |
| 2285 | struct namecache *ncp, *n2, *ndd; |
| 2286 | struct namecache_ts *ncp_ts; |
| 2287 | struct nchashhead *ncpp; |
| 2288 | uint32_t hash; |
| 2289 | int flag; |
| 2290 | int len; |
| 2291 | |
| 2292 | KASSERT(cnp->cn_namelen <= NAME_MAX, |
| 2293 | ("%s: passed len %ld exceeds NAME_MAX (%d)", __func__, cnp->cn_namelen, |
| 2294 | NAME_MAX)); |
| 2295 | VNPASS(dvp != vp, dvp); |
| 2296 | VNPASS(!VN_IS_DOOMED(dvp), dvp); |
| 2297 | VNPASS(dvp->v_type != VNON, dvp); |
| 2298 | if (vp != NULL) { |
| 2299 | VNPASS(!VN_IS_DOOMED(vp), vp); |
| 2300 | VNPASS(vp->v_type != VNON, vp); |
| 2301 | } |
| 2302 | |
| 2303 | #ifdef DEBUG_CACHE |
| 2304 | if (__predict_false(!doingcache)) |
| 2305 | return; |
| 2306 | #endif |
| 2307 | |
| 2308 | flag = 0; |
| 2309 | if (__predict_false(cnp->cn_nameptr[0] == '.')) { |
| 2310 | if (cnp->cn_namelen == 1) |
| 2311 | return; |
| 2312 | if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { |
| 2313 | cache_enter_dotdot_prep(dvp, vp, cnp); |
| 2314 | flag = NCF_ISDOTDOT; |
| 2315 | } |
| 2316 | } |
| 2317 | |
| 2318 | ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); |
| 2319 | if (ncp == NULL) |
| 2320 | return; |
| 2321 | |
| 2322 | cache_celockstate_init(&cel); |
| 2323 | ndd = NULL; |
| 2324 | ncp_ts = NULL; |
| 2325 | |
| 2326 | /* |
| 2327 | * Calculate the hash key and setup as much of the new |
| 2328 | * namecache entry as possible before acquiring the lock. |
| 2329 | */ |
| 2330 | ncp->nc_flag = flag | NCF_WIP; |
| 2331 | ncp->nc_vp = vp; |
| 2332 | if (vp == NULL) |
| 2333 | cache_neg_init(ncp); |
| 2334 | ncp->nc_dvp = dvp; |
| 2335 | if (tsp != NULL) { |
| 2336 | ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); |
| 2337 | ncp_ts->nc_time = *tsp; |
nothing calls this directly
no test coverage detected