Skip to content

erofs-utils: mkfs: add --hot-file-list for cold-start locality

Mengdie Yan linux-erofs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4erofs-utils: mkfs: prioritize hot files in directory sourcesinclude/erofs/hotfile.h include/erofs/internal.h lib/Makefile.am +4 more+821 -70 replies
2/4erofs-utils: mkfs: preserve hot file placement during compressionlib/compress.c man/mkfs.erofs.1 mkfs/main.c+21 -140 replies
3/4erofs-utils: mkfs: support hot file lists for full TAR importsinclude/erofs/hotfile.h lib/hotfile.c man/mkfs.erofs.1 +1 more+270 -170 replies
4/4erofs-utils: mkfs: support hot file lists for full OCI importsman/mkfs.erofs.1 mkfs/main.c+12 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] erofs-utils: mkfs: add --hot-file-list for cold-start locality

Hi,

When a container image is lazily loaded, its first start reads a small and mostly fixed set of files, whose data is spread across the image in directory traversal order. This turns the cold start into many small random reads.

This series adds a --hot-file-list option to mkfs.erofs:

  mkfs.erofs --hot-file-list=startup.list foo.erofs rootfs/

The list holds one image-relative path per line, typically recorded from a startup trace. Data of the listed regular files is allocated ahead of other files in list order, while unlisted files keep their relative order. Directories and symlinks along the listed paths are prioritized as well. Paths are resolved inside the image root, and missing entries are reported and skipped. Without the option, the output is unchanged.

Patch 1 adds the list parser and a hot pass in erofs_mkfs_dump_tree() for local directories. Patch 2 supports compression and keeps hot files out of fragments, since the packed inode is written last. Patches 3 and 4 add tar and OCI imports, where paths are resolved against the final imported tree.

With elasticsearch:8.13.0 and a list recorded from a real startup (610 regular files, 441 MB), reading the hot files in order from a cold loop device took 573 ms instead of 793 ms (-28%, median of 15 pairs).

Tested with local directory, tar and OCI sources and various compression options; image contents were verified with fsck.erofs and kernel mounts.

A regression test for experimental-tests is sent separately.

This series is based on erofs-utils dev at 652a204d0ec6.

Thanks,
Mengdie Yan

Mengdie Yan (4):
erofs-utils: mkfs: prioritize hot files in directory sources
erofs-utils: mkfs: preserve hot file placement during compression
erofs-utils: mkfs: support hot file lists for full TAR imports
erofs-utils: mkfs: support hot file lists for full OCI imports

 include/erofs/hotfile.h  |  25 ++
 include/erofs/internal.h |  11 +
 lib/Makefile.am          |   2 +
 lib/compress.c           |  19 +-
 lib/hotfile.c            | 754 +++++++++++++++++++++++++++++++++++++++
 lib/inode.c              | 202 ++++++++++-
 man/mkfs.erofs.1         |  24 ++
 mkfs/main.c              |  65 ++++
 8 files changed, 1091 insertions(+), 11 deletions(-)
 create mode 100644 include/erofs/hotfile.h
 create mode 100644 lib/hotfile.c

base-commit: 652a204d0ec628c887df88c95f76073502704c52

Signature · 1 line
2.50.1 (Apple Git-155)