mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Regular file reads copy data out of the image's shared mapping. When the image is backed by slow storage such as a FUSE mount, walking the mapping faults it in one page at a time, turning a large read into many small, largely serialized requests to the FUSE server. This makes erofs much slower than fsimpl/gofer for large reads on such backends. On those filesystems, read the data directly from the image file descriptor with preadv2(2) instead, so the host serves a large read with a single syscall and its own readahead, matching how fsimpl/gofer reads from host FDs. The mapping copy is kept everywhere else, since it avoids a syscall and is faster when the page cache is warm. The backing filesystem is detected at mount time via fstatfs(2); currently only FUSE opts into FD reads. Inode.Data, which returned the data as a mapping-backed BlockSeq, is replaced by Inode.DataRanges, which returns the image byte ranges that hold the inode's data.