[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

View File

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