[block_cache] Be better about flushing dirty blocks on demand.

Dirty blocks could prevent a clean lock being given.  Patch from mingus.
This commit is contained in:
Joe Thornber 2017-07-24 15:35:10 +01:00
parent b9009b53b6
commit 2c6278ed4b
1 changed files with 3 additions and 4 deletions

View File

@ -319,14 +319,13 @@ block_cache::new_block(block_address index)
block *b;
b = __alloc_block();
if (!b) {
if (clean_.empty()) {
while (!b && nr_locked_ < nr_cache_blocks_) {
b = find_unused_clean_block();
if (!b) {
if (io_pending_.empty())
writeback(16);
wait_io();
}
b = find_unused_clean_block();
}
if (b) {