github.com/grailbio/base@v0.0.11/file/internal/kernel/kernel.go (about) 1 package kernel 2 3 // MaxReadAhead configures the kernel's maximum readahead for file handles on this FUSE mount 4 // (via ConfigureMount) and our corresponding "trailing" buffer. 5 // 6 // Our sizingHandle implements Read operations for read-only fsctx.File objects that don't support 7 // random access or seeking. Generally this requires that the user reading such a file does so 8 // in-order. However, the kernel attempts to optimize i/o speed by reading ahead into the page cache 9 // and to do so it can issue concurrent reads for a few blocks ahead of the user's current position. 10 // We respond to such requests from our trailing buffer. 11 // TODO: Choose a value more carefully. This value was chosen fairly roughly based on some 12 // articles/discussion that suggested this was a kernel default. 13 const MaxReadAhead = 512 * 1024