- if (ncp->nc_id != ncp->nc_ip->i_id) {
- nchstats.ncs_falsehits++;
- } else if (!makeentry) {
- nchstats.ncs_badhits++;
- } else {
-
- /*
- * move this slot to end of LRU
- * chain, if not already there
- */
- if (ncp->nc_nxt) {
- /* remove from LRU chain */
- *ncp->nc_prev = ncp->nc_nxt;
- ncp->nc_nxt->nc_prev = ncp->nc_prev;
-
- /* and replace at end of it */
- ncp->nc_nxt = NULL;
- ncp->nc_prev = nchtail;
- *nchtail = ncp;
- nchtail = &ncp->nc_nxt;
- }
-
- /*
- * Get the next inode in the path.
- * See comment above other `IUNLOCK' code for
- * an explaination of the locking protocol.
- */
- pdp = dp;
- if (!isdotdot || dp != u.u_rdir)
- dp = ncp->nc_ip;
- if (dp == NULL)
- panic("nami: null cache ino");
- if (pdp == dp) {
- dp->i_count++;
- } else if (isdotdot) {
- IUNLOCK(pdp);
- igrab(dp);
- } else {
- igrab(dp);
- IUNLOCK(pdp);
- }
-
- /*
- * Verify that the inode that we got
- * did not change while we were waiting
- * for it to be locked.
- */
- if (ncp->nc_id != ncp->nc_ip->i_id) {
- iput(dp);
- ILOCK(pdp);
- dp = pdp;
- nchstats.ncs_falsehits++;
- } else {
- ndp->ni_dent.d_ino = dp->i_number;
- /* ni_dent.d_reclen is garbage ... */
- nchstats.ncs_goodhits++;
- goto haveino;
- }
- }
-
- /*
- * Last component and we are renaming or deleting,
- * the cache entry is invalid, or otherwise don't
- * want cache entry to exist.
- */
-
- /* remove from LRU chain */
- *ncp->nc_prev = ncp->nc_nxt;
- if (ncp->nc_nxt)
- ncp->nc_nxt->nc_prev = ncp->nc_prev;
- else
- nchtail = ncp->nc_prev;
-
- /* remove from hash chain */
- remque(ncp);
-
- /* insert at head of LRU list (first to grab) */
- ncp->nc_nxt = nchhead;
- ncp->nc_prev = &nchhead;
- nchhead->nc_prev = &ncp->nc_nxt;
- nchhead = ncp;
-
- /* and make a dummy hash chain */
- ncp->nc_forw = ncp;
- ncp->nc_back = ncp;
-
- ncp = NULL;