writeback: fix writeback cache thrashing, originally made by franco.  Based on commit 6ffd7d647a605fcb39be8ee71efe02cfb60f6886