- * Look for a the name in the cache. We don't do this
- * if the segment name is long, simply so the cache can avoid
- * holding long names (which would either waste space, or
+ * Delete an entry from its hash list and move it to the front
+ * of the LRU list for immediate reuse.
+ */
+#define PURGE(ncp) { \
+ LIST_REMOVE(ncp, nc_hash); \
+ ncp->nc_hash.le_prev = 0; \
+ TAILQ_REMOVE(&nclruhead, ncp, nc_lru); \
+ TAILQ_INSERT_HEAD(&nclruhead, ncp, nc_lru); \
+}
+
+/*
+ * Move an entry that has been used to the tail of the LRU list
+ * so that it will be preserved for future use.
+ */
+#define TOUCH(ncp) { \
+ if (ncp->nc_lru.tqe_next != 0) { \
+ TAILQ_REMOVE(&nclruhead, ncp, nc_lru); \
+ TAILQ_INSERT_TAIL(&nclruhead, ncp, nc_lru); \
+ } \
+}
+
+/*
+ * Lookup an entry in the cache
+ *
+ * We don't do this if the segment name is long, simply so the cache
+ * can avoid holding long names (which would either waste space, or