* 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. */
| 2575 | * prevents the various system daemons from flushing related buffers. |
| 2576 | */ |
| 2577 | void |
| 2578 | bwillwrite(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. |
no test coverage detected