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.
34 lines
670 B
Python
34 lines
670 B
Python
load("//tools:defs.bzl", "go_library", "go_test")
|
|
|
|
package(
|
|
default_applicable_licenses = ["//:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
go_library(
|
|
name = "erofs",
|
|
srcs = [
|
|
"erofs.go",
|
|
"erofs_unsafe.go",
|
|
],
|
|
marshal = True,
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//pkg/abi/linux",
|
|
"//pkg/cleanup",
|
|
"//pkg/errors/linuxerr",
|
|
"//pkg/gohacks",
|
|
"//pkg/hostarch",
|
|
"//pkg/log",
|
|
"//pkg/marshal",
|
|
"@org_golang_x_sys//unix:go_default_library",
|
|
],
|
|
)
|
|
|
|
go_test(
|
|
name = "erofs_test",
|
|
size = "small",
|
|
srcs = ["erofs_test.go"],
|
|
library = ":erofs",
|
|
)
|