| commit | e0db72ca567b5142bb6a31d745b3bf78cd8eb53a | [log] [tgz] |
|---|---|---|
| author | Jan Schär <jan@monogon.tech> | Wed Jun 18 18:14:07 2025 +0000 |
| committer | Jan Schär <jan@monogon.tech> | Wed Jun 25 15:37:52 2025 +0000 |
| tree | 9182fda3cfa5e5f407969f66d7ca01ff5dbd5734 | |
| parent | 16298986aba754618473fe7658f74c8ebe28ee7e [diff] |
osbase/blockdev: implement copy_file_range optimization This change enables the use of the copy_file_range syscall on Linux when copying from an os.File to a blockdev.File. This speeds up building of system images, especially with a file system which supports reflinks. The implementation is partially based on the implementation in the Go standard library for copy_file_range between two os.File in src/os/zero_copy_linux.go and src/internal/poll/copy_file_range_unix.go. We can't use that implementation, because it only supports using the file offset for both source and destination, but we want to provide the destination offset as an argument. To support this, the ReaderFromAt interface is introduced. With these changes, copy_file_range is now used when building system images, for both the rootfs and files on the FAT32 boot partition. If the file system supports it (e.g. XFS), reflinks will be used for the rootfs, which means no data is copied. For files on the FAT32 partition, reflinks probably can't be used, because these are only aligned to 512 bytes but would need to be aligned to 4096 bytes on my system for reflinking. Change-Id: Ie42b5834e6d3f63a5cc1f347d2681d8a6bb5c006 Reviewed-on: https://review.monogon.dev/c/monogon/+/4293 Tested-by: Jenkins CI Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
This is the main repository containing the source code for the Monogon Platform.
This is pre-release software - take a look, and check back later! In the meantime, join us on Matrix (#monogon-os-community:matrix.org) or Discord.
Our build environment is self-contained and requires only minimal host dependencies:
/dev/kvm (if you want to run tests).Our docs assume that Bazelisk is available as bazel on your PATH.
Refer to SETUP.md for detailed instructions.
The source code lives in //metropolis (Metropolis is the codename of Monogon OS).
See the //metropolis/README.md for a developer quick start guide, or see the Monogon OS Handbook for user documentation.