Skip to content

MicroVM restores keep sparse files sparse - #3882

Open
Mesut Oezdil (moezdil) wants to merge 2 commits into
agent-substrate:mainfrom
moezdil:tarutil-keep-sparse
Open

Mesut Oezdil (moezdil) wants to merge 2 commits into
agent-substrate:mainfrom
moezdil:tarutil-keep-sparse

Conversation

@moezdil

Copy link
Copy Markdown

microVM restore wrote sparse files in durable dirs and rootfs uppers fully allocated.
this follows the review of #2490: create saves the holes from SEEK_HOLE in a pax record (ATE.holes), extract skips only zeros in these holes.
so zeros the workload wrote (like zero-filled wal) and fully fallocated files (like a swap file) stay allocated.

the tar itself is same as before, archive/tar can't write sparse entries. only the extracted file is sparse.
old tars have no record and restore dense like today. a release without this change ignores the record, so rollback still works.
gvisor doesn't use tarutil.

on ext4, a 1 GiB file with 64 MiB data takes 64 MiB after extract, not 1024 MiB. extract takes around 140 ms instead of 470 ms.

Fixes #2489

AI use: AI-assisted, i reviewed and tested it.

  • Tests pass
  • Docs updated (none needed)

Extract wrote every regular file densely, so a microVM restore
allocated the holes of sparse files in durable dirs and rootfs uppers.

Create now records the holes SEEK_HOLE reports in an ATE.holes PAX
record, for files with fewer blocks allocated than their size.
Extract leaves the zero chunks in those holes unwritten. Zeros the
workload wrote, and fully fallocated files, stay allocated. Archives
without the record, and releases that don't know it, restore files
densely as before.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Durable-dir restore writes sparse files fully allocated

1 participant