]> git.hungrycats.org Git - bees/commitdiff
readahead: size_t is 32 bits on ILP32 platforms
authorZygo Blaxell <bees@furryterror.org>
Fri, 12 Sep 2025 05:42:48 +0000 (01:42 -0400)
committerZygo Blaxell <bees@furryterror.org>
Fri, 12 Sep 2025 07:12:06 +0000 (03:12 -0400)
Cast size_t so it matches uint64_t for the std::min template.

Fixes: https://github.com/Zygo/bees/issues/323
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees.cc

index 99cd7822176a7a5277606f072c3f475defc0a100..45b5e65c4e894a505deee96bbc862eed7c5e4505 100644 (file)
@@ -255,12 +255,12 @@ bees_readahead_nolock(int const fd, const off_t offset, const size_t size)
        // The btrfs kernel code does readahead with lower ioprio
        // and might discard the readahead request entirely.
        BEESNOTE("emulating readahead " << name_fd(fd) << " offset " << to_hex(offset) << " len " << pretty(size));
-       auto working_size = min(size, uint64_t(128 * 1024 * 1024));
+       auto working_size = min(uint64_t(size), uint64_t(128 * 1024 * 1024));
        auto working_offset = offset;
        while (working_size) {
                // don't care about multithreaded writes to this buffer--it is garbage anyway
                static uint8_t dummy[BEES_READAHEAD_SIZE];
-               const size_t this_read_size = min(working_size, sizeof(dummy));
+               const size_t this_read_size = min(working_size, uint64_t(sizeof(dummy)));
                // Ignore errors and short reads.  It turns out our size
                // parameter isn't all that accurate, so we can't use
                // the pread_or_die template.