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

Function biodone

freebsd/kern/vfs_bio.c:4329–4367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4327static struct bio_queue nondump_bios;
4328
4329void
4330biodone(struct bio *bp)
4331{
4332 struct mtx *mtxp;
4333 void (*done)(struct bio *);
4334 vm_offset_t start, end;
4335
4336 biotrack(bp, __func__);
4337
4338 /*
4339 * Avoid completing I/O when dumping after a panic since that may
4340 * result in a deadlock in the filesystem or pager code. Note that
4341 * this doesn't affect dumps that were started manually since we aim
4342 * to keep the system usable after it has been resumed.
4343 */
4344 if (__predict_false(dumping && SCHEDULER_STOPPED())) {
4345 TAILQ_INSERT_HEAD(&nondump_bios, bp, bio_queue);
4346 return;
4347 }
4348 if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) {
4349 bp->bio_flags &= ~BIO_TRANSIENT_MAPPING;
4350 bp->bio_flags |= BIO_UNMAPPED;
4351 start = trunc_page((vm_offset_t)bp->bio_data);
4352 end = round_page((vm_offset_t)bp->bio_data + bp->bio_length);
4353 bp->bio_data = unmapped_buf;
4354 pmap_qremove(start, atop(end - start));
4355 vmem_free(transient_arena, start, end - start);
4356 atomic_add_int(&inflight_transient_maps, -1);
4357 }
4358 done = bp->bio_done;
4359 if (done == NULL) {
4360 mtxp = mtx_pool_find(mtxpool_sleep, bp);
4361 mtx_lock(mtxp);
4362 bp->bio_flags |= BIO_DONE;
4363 wakeup(bp);
4364 mtx_unlock(mtxp);
4365 } else
4366 done(bp);
4367}
4368
4369/*
4370 * Wait for a BIO to finish.

Callers 1

biofinishFunction · 0.85

Calls 8

biotrackFunction · 0.85
vmem_freeFunction · 0.85
mtx_pool_findFunction · 0.85
doneFunction · 0.85
mtx_lockFunction · 0.70
wakeupFunction · 0.70
mtx_unlockFunction · 0.70
pmap_qremoveFunction · 0.50

Tested by

no test coverage detected