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

Function vdbatch_enqueue

freebsd/kern/vfs_subr.c:3438–3469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3436}
3437
3438static void
3439vdbatch_enqueue(struct vnode *vp)
3440{
3441 struct vdbatch *vd;
3442
3443 ASSERT_VI_LOCKED(vp, __func__);
3444 VNASSERT(!VN_IS_DOOMED(vp), vp,
3445 ("%s: deferring requeue of a doomed vnode", __func__));
3446
3447 if (vp->v_dbatchcpu != NOCPU) {
3448 VI_UNLOCK(vp);
3449 return;
3450 }
3451
3452 sched_pin();
3453 vd = DPCPU_PTR(vd);
3454 mtx_lock(&vd->lock);
3455 MPASS(vd->index < VDBATCH_SIZE);
3456 MPASS(vd->tab[vd->index] == NULL);
3457 /*
3458 * A hack: we depend on being pinned so that we know what to put in
3459 * ->v_dbatchcpu.
3460 */
3461 vp->v_dbatchcpu = curcpu;
3462 vd->tab[vd->index] = vp;
3463 vd->index++;
3464 VI_UNLOCK(vp);
3465 if (vd->index == VDBATCH_SIZE)
3466 vdbatch_process(vd);
3467 mtx_unlock(&vd->lock);
3468 sched_unpin();
3469}
3470
3471/*
3472 * This routine must only be called for vnodes which are about to be

Callers 1

vdrop_deactivateFunction · 0.85

Calls 5

sched_pinFunction · 0.85
vdbatch_processFunction · 0.85
sched_unpinFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected