Lines Matching defs:li

75 #define	TABLE_LOCK(vp, li)      \
76 (&(li)->li_hashtable[ltablehash((vp), (li)->li_htsize)].lh_lock)
81 #define TABLE_BUCKET(vp, li) \
82 ((li)->li_hashtable[ltablehash((vp), (li)->li_htsize)].lh_chain)
87 #define TABLE_COUNT(vp, li) \
88 ((li)->li_hashtable[ltablehash((vp), (li)->li_htsize)].lh_count)
93 #define TABLE_LOCK_ENTER(vp, li) table_lock_enter(vp, li)
94 #define TABLE_LOCK_EXIT(vp, li) \
95 mutex_exit(&(li)->li_hashtable[ltablehash((vp), \
96 (li)->li_htsize)].lh_lock)
112 * (a) li->li_htlock protects li->li_hashtable, li->li_htsize, and
113 * li->li_retired.
139 * to li->li_htsize:
142 * - t2 loads li->li_htsize and li->li_hashtable
143 * - t1 changes li->hashtable
152 table_lock_enter(vnode_t *vp, struct loinfo *li)
159 htsize = li->li_htsize;
161 chain = (struct lobucket *)li->li_hashtable;
164 if (li->li_hashtable == chain && li->li_htsize == htsize)
191 lsetup(struct loinfo *li, uint_t htsize)
193 li->li_refct = 0;
194 li->li_lfs = NULL;
197 li->li_htsize = htsize;
198 li->li_hashtable = kmem_zalloc(htsize * sizeof (*li->li_hashtable),
200 mutex_init(&li->li_lfslock, NULL, MUTEX_DEFAULT, NULL);
201 mutex_init(&li->li_htlock, NULL, MUTEX_DEFAULT, NULL);
202 li->li_retired = NULL;
209 ldestroy(struct loinfo *li)
215 mutex_destroy(&li->li_htlock);
216 mutex_destroy(&li->li_lfslock);
217 htsize = li->li_htsize;
218 table = li->li_hashtable;
221 kmem_free(table, htsize * sizeof (*li->li_hashtable));
226 lrhp = li->li_retired;
231 trhp->lrh_size * sizeof (*li->li_hashtable));
234 li->li_retired = NULL;
252 makelonode(struct vnode *vp, struct loinfo *li, int flag)
259 TABLE_LOCK_ENTER(vp, li);
261 lp = lfind(vp, li);
269 TABLE_LOCK_EXIT(vp, li);
279 TABLE_LOCK_ENTER(vp, li);
281 lp = lfind(vp, li);
290 atomic_inc_32(&li->li_refct);
291 vfsp = makelfsnode(vp->v_vfsp, li);
299 lsave(lp, li);
306 TABLE_LOCK_EXIT(vp, li);
314 makelfsnode(struct vfs *vfsp, struct loinfo *li)
322 if (vfsp == li->li_realvfs)
323 return (li->li_mountvfs);
324 ASSERT(li->li_refct > 0);
325 mutex_enter(&li->li_lfslock);
326 if ((lfs = lfsfind(vfsp, li)) == NULL) {
327 mutex_exit(&li->li_lfslock);
329 mutex_enter(&li->li_lfslock);
330 if ((tlfs = lfsfind(vfsp, li)) != NULL) {
342 VFS_INIT(&lfs->lfs_vfs, lo_vfsops, (caddr_t)li);
343 lfs->lfs_vfs.vfs_fstype = li->li_mountvfs->vfs_fstype;
345 ((vfsp->vfs_flag | li->li_mflag) & ~li->li_dflag) &
365 lfs->lfs_next = li->li_lfs;
366 li->li_lfs = lfs;
372 mutex_exit(&li->li_lfslock);
380 freelfsnode(struct lfsnode *lfs, struct loinfo *li)
385 ASSERT(MUTEX_HELD(&li->li_lfslock));
386 ASSERT(li->li_refct > 0);
387 for (this = li->li_lfs; this != NULL; this = this->lfs_next) {
391 li->li_lfs = lfs->lfs_next;
417 * Find lfs given real vfs and mount instance(li)
420 lfsfind(struct vfs *vfsp, struct loinfo *li)
424 ASSERT(MUTEX_HELD(&li->li_lfslock));
441 for (lfs = li->li_lfs; lfs != NULL; lfs = lfs->lfs_next) {
462 struct loinfo *li = vtoli(vfsp);
465 ASSERT(li->li_refct > 0);
466 if (vfsp == li->li_mountvfs) {
468 *realrootvpp = vtol(li->li_rootvp)->lo_vp;
469 return (li->li_realvfs);
471 mutex_enter(&li->li_lfslock);
472 for (lfs = li->li_lfs; lfs != NULL; lfs = lfs->lfs_next) {
476 mutex_exit(&li->li_lfslock);
497 lretire(struct loinfo *li, struct lobucket *table, uint_t size)
505 mutex_enter(&li->li_htlock);
506 lrhp->lrh_next = li->li_retired;
507 li->li_retired = lrhp;
508 mutex_exit(&li->li_htlock);
515 lgrow(struct loinfo *li, uint_t newsize)
526 if ((newtable = kmem_zalloc(newsize * sizeof (*li->li_hashtable),
530 mutex_enter(&li->li_htlock);
531 if (newsize <= li->li_htsize) {
532 mutex_exit(&li->li_htlock);
533 kmem_free(newtable, newsize * sizeof (*li->li_hashtable));
536 oldsize = li->li_htsize;
537 oldtable = li->li_hashtable;
546 * li->li_hashtable gets set before li->li_htsize, so in the
576 li->li_hashtable = newtable;
579 * table_lock_enter() relies on the fact that li->li_hashtable
580 * is set to its new value before li->li_htsize.
583 li->li_htsize = newsize;
592 mutex_exit(&li->li_htlock);
594 lretire(li, oldtable, oldsize);
601 lsave(lnode_t *lp, struct loinfo *li)
604 ASSERT(MUTEX_HELD(TABLE_LOCK(lp->lo_vp, li)));
608 lp, ltablehash(lp->lo_vp, li));
611 TABLE_COUNT(lp->lo_vp, li)++;
612 lp->lo_next = TABLE_BUCKET(lp->lo_vp, li);
613 TABLE_BUCKET(lp->lo_vp, li) = lp;
615 if (li->li_refct > (li->li_htsize << lo_resize_threshold)) {
616 TABLE_LOCK_EXIT(lp->lo_vp, li);
617 lgrow(li, li->li_htsize << lo_resize_factor);
618 TABLE_LOCK_ENTER(lp->lo_vp, li);
627 lfs_rele(struct lfsnode *lfs, struct loinfo *li)
631 ASSERT(MUTEX_HELD(&li->li_lfslock));
634 freelfsnode(lfs, li);
649 struct loinfo *li = vtoli(vp->v_vfsp);
653 lp, ltablehash(lp->lo_vp, li));
655 TABLE_LOCK_ENTER(lp->lo_vp, li);
661 TABLE_LOCK_EXIT(lp->lo_vp, li);
666 for (lt = TABLE_BUCKET(lp->lo_vp, li); lt != NULL;
673 atomic_dec_32(&li->li_refct);
676 if (vfsp != li->li_mountvfs) {
677 mutex_enter(&li->li_lfslock);
681 lfs = li->li_lfs;
685 lfs_rele(lfs, li);
692 freelfsnode(lfs, li);
696 mutex_exit(&li->li_lfslock);
699 TABLE_BUCKET(lt->lo_vp, li) = lt->lo_next;
703 TABLE_COUNT(lt->lo_vp, li)--;
704 TABLE_LOCK_EXIT(lt->lo_vp, li);
719 lfind(struct vnode *vp, struct loinfo *li)
723 ASSERT(MUTEX_HELD(TABLE_LOCK(vp, li)));
725 lt = TABLE_BUCKET(vp, li);