Lines Matching refs:dirhash

59 #include <ufs/ufs/dirhash.h>
78 0, "maximum allowed dirhash memory usage");
81 0, "current dirhash memory usage");
94 static int ufsdirhash_hash(struct dirhash *dh, char *name, int namelen);
95 static void ufsdirhash_adjfree(struct dirhash *dh, doff_t offset, int diff);
96 static void ufsdirhash_delslot(struct dirhash *dh, int slot);
97 static int ufsdirhash_findslot(struct dirhash *dh, char *name, int namelen,
114 static TAILQ_HEAD(, dirhash) ufsdirhash_list;
122 * The relationship between inode and dirhash is protected either by an
124 * may be used. The dirhash_mtx is acquired after the dirhash lock. To
125 * handle teardown races, code wishing to lock the dirhash for an inode
127 * dirhash while holding the vnode interlock. They can drop it once they
128 * have obtained the dirhash lock and verified that the dirhash wasn't
129 * recycled while they waited for the dirhash lock.
131 * ufsdirhash_build() acquires a shared lock on the dirhash when it is
135 * free a dirhash structure that was recycled by ufsdirhash_recycle().
137 * The dirhash lock may be held across io operations.
140 * and the "dirhash" lock. However, this specific reversal will not
142 * buffer followed by the dirhash while a second thread locked a
143 * buffer while holding the dirhash lock. The second order can happen
147 * a thread to be doing a "bufwait" -> "dirhash" order, it has to hold
149 * any other threads from doing a "dirhash" -> "bufwait" order.
153 ufsdirhash_hold(struct dirhash *dh)
160 ufsdirhash_drop(struct dirhash *dh)
170 * Release the lock on a dirhash.
173 ufsdirhash_release(struct dirhash *dh)
186 static struct dirhash *
189 struct dirhash *ndh;
190 struct dirhash *dh;
198 /* Racy check for i_dirhash to prefetch a dirhash structure. */
210 * the one for this dirhash we are creating
214 sx_init_flags(&ndh->dh_lock, "dirhash", SX_DUPOK);
272 static struct dirhash *
275 struct dirhash *dh;
298 struct dirhash *dh;
303 /* Grab a reference on this inode's dirhash if it has one. */
313 /* Exclusively lock the dirhash. */
316 /* If this dirhash still belongs to this inode, then free it. */
326 * This inode's dirhash has changed while we were
327 * waiting for the dirhash lock, so try again.
342 struct dirhash *dh;
357 /* Check if we can/should use dirhash. */
480 struct dirhash *dh;
508 * own reference on the dirhash structure. They will drop
549 struct dirhash *dh, *dh_next;
559 ("ufsdirhash_lookup: Invalid dirhash %p\n", dh));
562 * Move this dirhash towards the end of the list if it has a
575 KASSERT(dh->dh_onlist, ("dirhash: not on list"));
703 struct dirhash *dh;
710 ("ufsdirhash_findfree: Invalid dirhash %p\n", dh));
778 struct dirhash *dh;
784 ("ufsdirhash_enduseful: Invalid dirhash %p\n", dh));
804 struct dirhash *dh;
845 struct dirhash *dh;
872 struct dirhash *dh;
888 * Inform dirhash that the directory has grown by one block that
894 struct dirhash *dh;
918 * Inform dirhash that the directory is being truncated.
923 struct dirhash *dh;
961 * Debugging function to check that the dirhash information about
972 struct dirhash *dh;
1027 * Hash the specified filename into a dirhash slot.
1030 ufsdirhash_hash(struct dirhash *dh, char *name, int namelen)
1036 * invariant over the dirhash's lifetime. Otherwise names
1054 ufsdirhash_adjfree(struct dirhash *dh, doff_t offset, int diff)
1061 ("dirhash bad offset"));
1090 ufsdirhash_findslot(struct dirhash *dh, char *name, int namelen, doff_t offset)
1097 KASSERT(dh->dh_hused < dh->dh_hlen, ("dirhash find full"));
1114 ufsdirhash_delslot(struct dirhash *dh, int slot)
1171 * Delete the given dirhash and reclaim its memory. Assumes that
1176 ufsdirhash_destroy(struct dirhash *dh)
1182 KASSERT(dh->dh_hash != NULL, ("dirhash: NULL hash on list"));
1195 /* Unlock dirhash and free the detached memory. */
1215 struct dirhash *dh;
1249 struct dirhash *dh, *dh_temp;
1252 * Will free a *minimum* of 10% of the dirhash, but possibly much
1264 * seconds. If we can't get a lock on the dirhash, it will be skipped.
1271 /* Unlock if we didn't delete the dirhash */
1278 * of the dirhash list. The ones closest to the head should be the
1302 mtx_init(&ufsdirhash_mtx, "dirhash list", NULL, MTX_DEF);