mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
readahead: update comments to reflect bakeoff results
It turns out that readahead() alone is fastest. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
6325f9ed72
commit
5e379b4c48
14
src/bees.cc
14
src/bees.cc
@ -231,17 +231,23 @@ bees_readahead(int const fd, off_t offset, size_t size)
|
|||||||
Timer readahead_timer;
|
Timer readahead_timer;
|
||||||
BEESNOTE("readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
|
BEESNOTE("readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
|
||||||
BEESTOOLONG("readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
|
BEESTOOLONG("readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
|
||||||
|
#if 1
|
||||||
// In the kernel, readahead() is identical to posix_fadvise(..., POSIX_FADV_DONTNEED)
|
// In the kernel, readahead() is identical to posix_fadvise(..., POSIX_FADV_DONTNEED)
|
||||||
DIE_IF_NON_ZERO(readahead(fd, offset, size));
|
DIE_IF_NON_ZERO(readahead(fd, offset, size));
|
||||||
#if 0
|
#else
|
||||||
// Make sure this data is in page cache by brute force
|
// Make sure this data is in page cache by brute force
|
||||||
// This isn't necessary and it might even be slower
|
// This isn't necessary and it might even be slower,
|
||||||
|
// but the btrfs kernel code does readahead with lower ioprio
|
||||||
|
// and might discard the readahead request entirely,
|
||||||
|
// so it's maybe, *maybe*, worth doing both.
|
||||||
BEESNOTE("emulating readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
|
BEESNOTE("emulating readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
|
||||||
while (size) {
|
while (size) {
|
||||||
|
// don't care about multithreaded writes to this buffer--it is garbage anyway
|
||||||
static uint8_t dummy[BEES_READAHEAD_SIZE];
|
static uint8_t dummy[BEES_READAHEAD_SIZE];
|
||||||
size_t this_read_size = min(size, sizeof(dummy));
|
size_t this_read_size = min(size, sizeof(dummy));
|
||||||
// Ignore errors and short reads.
|
// Ignore errors and short reads. It turns out our size
|
||||||
// It turns out our size parameter isn't all that accurate.
|
// parameter isn't all that accurate, so we can't use
|
||||||
|
// the pread_or_die template.
|
||||||
(void)!pread(fd, dummy, this_read_size, offset);
|
(void)!pread(fd, dummy, this_read_size, offset);
|
||||||
BEESCOUNT(readahead_count);
|
BEESCOUNT(readahead_count);
|
||||||
BEESCOUNTADD(readahead_bytes, this_read_size);
|
BEESCOUNTADD(readahead_bytes, this_read_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user