Lines Matching refs:hint
1586 * Find the current thread's directory hint for a given index.
1590 * Use detach if the cnode lock must be dropped while the hint is still active.
1597 directoryhint_t *hint;
1604 * Look for an existing hint first. If not found, create a new one (when
1605 * the list is not full) or recycle the oldest hint. Since new hints are
1606 * always added to the head of the list, the last hint is always the
1609 TAILQ_FOREACH(hint, &dcp->c_hintlist, dh_link) {
1610 if (hint->dh_index == index)
1613 if (hint != NULL) { /* found an existing hint */
1616 } else { /* cannot find an existing hint */
1619 /* Create a default directory hint */
1620 MALLOC_ZONE(hint, directoryhint_t *, sizeof(directoryhint_t), M_HFSDIRHINT, M_WAITOK);
1623 } else { /* recycle the last (i.e., the oldest) hint */
1624 hint = TAILQ_LAST(&dcp->c_hintlist, hfs_hinthead);
1625 if ((hint->dh_desc.cd_flags & CD_HASBUF) &&
1626 (name = hint->dh_desc.cd_nameptr)) {
1627 hint->dh_desc.cd_nameptr = NULL;
1628 hint->dh_desc.cd_namelen = 0;
1629 hint->dh_desc.cd_flags &= ~CD_HASBUF;
1637 TAILQ_REMOVE(&dcp->c_hintlist, hint, dh_link);
1642 TAILQ_INSERT_HEAD(&dcp->c_hintlist, hint, dh_link);
1645 hint->dh_index = index;
1646 hint->dh_desc.cd_flags = 0;
1647 hint->dh_desc.cd_encoding = 0;
1648 hint->dh_desc.cd_namelen = 0;
1649 hint->dh_desc.cd_nameptr = NULL;
1650 hint->dh_desc.cd_parentcnid = dcp->c_fileid;
1651 hint->dh_desc.cd_hint = dcp->c_childhint;
1652 hint->dh_desc.cd_cnid = 0;
1654 hint->dh_time = tv.tv_sec;
1655 return (hint);
1659 * Release a single directory hint.
1668 directoryhint_t *hint;
1671 TAILQ_FOREACH(hint, &dcp->c_hintlist, dh_link) {
1672 if (hint == relhint) {
1698 directoryhint_t *hint, *prev;
1705 for (hint = TAILQ_LAST(&dcp->c_hintlist, hfs_hinthead); hint != NULL; hint = prev) {
1706 if (stale_hints_only && (tv.tv_sec - hint->dh_time) < HFS_DIRHINT_TTL)
1708 name = hint->dh_desc.cd_nameptr;
1709 if ((hint->dh_desc.cd_flags & CD_HASBUF) && (name != NULL)) {
1710 hint->dh_desc.cd_nameptr = NULL;
1711 hint->dh_desc.cd_namelen = 0;
1712 hint->dh_desc.cd_flags &= ~CD_HASBUF;
1715 prev = TAILQ_PREV(hint, hfs_hinthead, dh_link); /* must save this pointer before calling FREE_ZONE on this node */
1716 TAILQ_REMOVE(&dcp->c_hintlist, hint, dh_link);
1717 FREE_ZONE(hint, sizeof(directoryhint_t), M_HFSDIRHINT);
1723 * Insert a detached directory hint back into the list of dirhints.
1729 hfs_insertdirhint(struct cnode *dcp, directoryhint_t * hint)
1734 if (test == hint)
1735 panic("hfs_insertdirhint: hint %p already on list!", hint);
1738 TAILQ_INSERT_HEAD(&dcp->c_hintlist, hint, dh_link);