Lines Matching refs:hint

1792  * Find the current thread's directory hint for a given index.
1796 * Use detach if the cnode lock must be dropped while the hint is still active.
1803 directoryhint_t *hint;
1810 * Look for an existing hint first. If not found, create a new one (when
1811 * the list is not full) or recycle the oldest hint. Since new hints are
1812 * always added to the head of the list, the last hint is always the
1815 TAILQ_FOREACH(hint, &dcp->c_hintlist, dh_link) {
1816 if (hint->dh_index == index)
1819 if (hint != NULL) { /* found an existing hint */
1822 } else { /* cannot find an existing hint */
1825 /* Create a default directory hint */
1826 MALLOC_ZONE(hint, directoryhint_t *, sizeof(directoryhint_t), M_HFSDIRHINT, M_WAITOK);
1829 } else { /* recycle the last (i.e., the oldest) hint */
1830 hint = TAILQ_LAST(&dcp->c_hintlist, hfs_hinthead);
1831 if ((hint->dh_desc.cd_flags & CD_HASBUF) &&
1832 (name = hint->dh_desc.cd_nameptr)) {
1833 hint->dh_desc.cd_nameptr = NULL;
1834 hint->dh_desc.cd_namelen = 0;
1835 hint->dh_desc.cd_flags &= ~CD_HASBUF;
1843 TAILQ_REMOVE(&dcp->c_hintlist, hint, dh_link);
1848 TAILQ_INSERT_HEAD(&dcp->c_hintlist, hint, dh_link);
1851 hint->dh_index = index;
1852 hint->dh_desc.cd_flags = 0;
1853 hint->dh_desc.cd_encoding = 0;
1854 hint->dh_desc.cd_namelen = 0;
1855 hint->dh_desc.cd_nameptr = NULL;
1856 hint->dh_desc.cd_parentcnid = dcp->c_fileid;
1857 hint->dh_desc.cd_hint = dcp->c_childhint;
1858 hint->dh_desc.cd_cnid = 0;
1860 hint->dh_time = tv.tv_sec;
1861 return (hint);
1865 * Release a single directory hint.
1874 directoryhint_t *hint;
1877 TAILQ_FOREACH(hint, &dcp->c_hintlist, dh_link) {
1878 if (hint == relhint) {
1904 directoryhint_t *hint, *prev;
1911 for (hint = TAILQ_LAST(&dcp->c_hintlist, hfs_hinthead); hint != NULL; hint = prev) {
1912 if (stale_hints_only && (tv.tv_sec - hint->dh_time) < HFS_DIRHINT_TTL)
1914 name = hint->dh_desc.cd_nameptr;
1915 if ((hint->dh_desc.cd_flags & CD_HASBUF) && (name != NULL)) {
1916 hint->dh_desc.cd_nameptr = NULL;
1917 hint->dh_desc.cd_namelen = 0;
1918 hint->dh_desc.cd_flags &= ~CD_HASBUF;
1921 prev = TAILQ_PREV(hint, hfs_hinthead, dh_link); /* must save this pointer before calling FREE_ZONE on this node */
1922 TAILQ_REMOVE(&dcp->c_hintlist, hint, dh_link);
1923 FREE_ZONE(hint, sizeof(directoryhint_t), M_HFSDIRHINT);
1929 * Insert a detached directory hint back into the list of dirhints.
1935 hfs_insertdirhint(struct cnode *dcp, directoryhint_t * hint)
1940 if (test == hint)
1941 panic("hfs_insertdirhint: hint %p already on list!", hint);
1944 TAILQ_INSERT_HEAD(&dcp->c_hintlist, hint, dh_link);