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

Function bwillwrite

freebsd/kern/vfs_bio.c:2577–2590  ·  view source on GitHub ↗

* bwillwrite: * * Called prior to the locking of any vnodes when we are expecting to * write. We do not want to starve the buffer cache with too many * dirty buffers so we block here. By blocking prior to the locking * of any vnodes we attempt to avoid the situation where a locked vnode * prevents the various system daemons from flushing related buffers. */

Source from the content-addressed store, hash-verified

2575 * prevents the various system daemons from flushing related buffers.
2576 */
2577void
2578bwillwrite(void)
2579{
2580
2581 if (buf_dirty_count_severe()) {
2582 mtx_lock(&bdirtylock);
2583 while (buf_dirty_count_severe()) {
2584 bdirtywait = 1;
2585 msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4),
2586 "flswai", 0);
2587 }
2588 mtx_unlock(&bdirtylock);
2589 }
2590}
2591
2592/*
2593 * Return true if we have too many dirty buffers.

Callers 15

vn_open_credFunction · 0.70
vn_rdwr_inchunksFunction · 0.70
vn_writeFunction · 0.70
vn_write_outvpFunction · 0.70
vn_fallocateFunction · 0.70
aio_process_rwFunction · 0.70
kern_mknodatFunction · 0.70
kern_mkfifoatFunction · 0.70
kern_linkatFunction · 0.70
kern_symlinkatFunction · 0.70
sys_undeleteFunction · 0.70
kern_funlinkatFunction · 0.70

Calls 3

buf_dirty_count_severeFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected