return rv.second;
}
-static
void
-bees_readahead_nolock(int const fd, const off_t offset, const size_t size)
+bees_readahead_raw(int const fd, const off_t offset, const size_t size)
{
- if (!bees_readahead_check(fd, offset, size)) return;
Timer readahead_timer;
BEESNOTE("readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
BEESTOOLONG("readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
BEESCOUNTADD(readahead_ms, readahead_timer.age() * 1000);
}
+static
+void
+bees_readahead_nolock(int const fd, const off_t offset, const size_t size)
+{
+ if (!bees_readahead_check(fd, offset, size)) return;
+ bees_readahead_raw(fd, offset, size);
+}
+
static mutex s_only_one;
void
/// FADV_WILLNEED submits reads at iopriority 3, which are preempted by bees's own
/// reader threads and may never execute; using pread() forces the data into the page
/// cache immediately under normal thread scheduling.
+/// This function implements a number of workarounds intended to improve
+/// the behavior of legacy v0.11 scan_one_extent code. It should not be
+/// used for new code.
void bees_readahead(int fd, off_t offset, size_t size);
/// Emulate POSIX_FADV_WILLNEED for two ranges simultaneously via pread().
-/// @see bees_readahead
+/// This function is used for the legacy v0.11 match extension code.
+/// It should not be used for new code.
void bees_readahead_pair(int fd, off_t offset, size_t size, int fd2, off_t offset2, size_t size2);
+/// Emulate POSIX_FADV_WILLNEED with no legacy baggage.
+/// This function is called to work around specific kernel dedupe
+/// performance issues. All other bees_readahead_* functions eventually
+/// call this one to perform the emulation.
+void bees_readahead_raw(int fd, off_t offset, size_t size);
+
/// Issue POSIX_FADV_DONTNEED to release cached pages for the given range.
void bees_unreadahead(int fd, off_t offset, size_t size);