MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vnode_init

Function vnode_init

freebsd/kern/vfs_subr.c:533–574  ·  view source on GitHub ↗

* Initialize a vnode as it first enters the zone. */

Source from the content-addressed store, hash-verified

531 * Initialize a vnode as it first enters the zone.
532 */
533static int
534vnode_init(void *mem, int size, int flags)
535{
536 struct vnode *vp;
537
538 vp = mem;
539 bzero(vp, size);
540 /*
541 * Setup locks.
542 */
543 vp->v_vnlock = &vp->v_lock;
544 mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF);
545 /*
546 * By default, don't allow shared locks unless filesystems opt-in.
547 */
548 lockinit(vp->v_vnlock, PVFS, "vnode", VLKTIMEOUT,
549 LK_NOSHARE | LK_IS_VNODE);
550 /*
551 * Initialize bufobj.
552 */
553 bufobj_init(&vp->v_bufobj, vp);
554 /*
555 * Initialize namecache.
556 */
557 cache_vnode_init(vp);
558 /*
559 * Initialize rangelocks.
560 */
561 rangelock_init(&vp->v_rl);
562
563 vp->v_dbatchcpu = NOCPU;
564
565 /*
566 * Check vhold_recycle_free for an explanation.
567 */
568 vp->v_holdcnt = VHOLD_NO_SMR;
569 vp->v_type = VNON;
570 mtx_lock(&vnode_list_mtx);
571 TAILQ_INSERT_BEFORE(vnode_list_free_marker, vp, v_vnodelist);
572 mtx_unlock(&vnode_list_mtx);
573 return (0);
574}
575
576/*
577 * Free a vnode when it is cleared from the zone.

Callers

nothing calls this directly

Calls 8

bzeroFunction · 0.85
mtx_initFunction · 0.85
lockinitFunction · 0.85
bufobj_initFunction · 0.85
cache_vnode_initFunction · 0.85
rangelock_initFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected