If the extent wasn't read in the last second, chances are high that
it was evicted from the page cache. If the extents have been evicted
from the cache by the time we grow or dedupe them, we'll take a serious
performance hit as we read them back in, one page at a time.
Use a 5-second delay to match the default writeback interval.
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
auto tup = make_tuple(offset, size, stat_rv.st_dev, stat_rv.st_ino);
static mutex s_recent_mutex;
static set<decltype(tup)> s_recent;
+ static Timer s_recent_timer;
unique_lock<mutex> lock(s_recent_mutex);
- if (s_recent.size() > BEES_MAX_EXTENT_REF_COUNT) {
+ if (s_recent_timer.age() > 5.0) {
+ s_recent_timer.reset();
s_recent.clear();
BEESCOUNT(readahead_clear);
}