Skip to content

Conversation

@hsiangkao
Copy link
Member

@hsiangkao hsiangkao commented Oct 15, 2025

a prerequisite for containerd/nerdbox#30

EROFS has supported a tiny metadata-only image to reference external blobs since Linux 5.16. This eliminates the need to mount each EROFS layer one by one and is also useful for VM-based containers (e.g. nerdbox and Kata containers.)

Similar to LCOW/CimFS, snapshots.UnpackKeyPrefix is used to trigger fsmerge generation (typically < 100 ms) on demand in Prepare().

In the future, we can also generate fsmeta in Commit() of the final unpacking layer (by introducing an annotation to keep the chainID). However, in the case of intermediate layer reuse, the Prepare() handling will still be required.

[plugins."io.containerd.snapshotter.v1.erofs"]
  max_unmerged_layers = 1      # enable fsmerge if image layers >= 2

This change is based on #12333 merged

@github-project-automation github-project-automation bot moved this to Needs Triage in Pull Request Review Oct 15, 2025
@hsiangkao hsiangkao marked this pull request as draft October 15, 2025 16:46
@dosubot dosubot bot added the kind/feature label Oct 15, 2025
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch from 96934d4 to 6076bcb Compare October 20, 2025 07:49
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch from 6076bcb to 69d2a33 Compare October 22, 2025 01:59
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch 3 times, most recently from 4a2b254 to fca4a46 Compare October 24, 2025 09:30
@hsiangkao hsiangkao mentioned this pull request Nov 4, 2025
10 tasks
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch from fca4a46 to 53d11cc Compare November 20, 2025 04:05
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch 2 times, most recently from 19056af to c93c21d Compare November 20, 2025 09:56
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch from c93c21d to 84a35fc Compare November 20, 2025 15:58
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch 2 times, most recently from 2359163 to 8de5fb9 Compare November 20, 2025 16:21
@dmcgowan dmcgowan self-assigned this Nov 20, 2025
td = ""

if !strings.Contains(key, snapshots.UnpackKeyPrefix) {
s.generateFsMeta(ctx, snap.ParentIDs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to handle this outside the transaction, in case the command gets stuck?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like it's nice to have. so it should be safe to move it outside the transaction

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very sorry about this, I thought I replied this but it seems not, yeah, I've moved the generation part out the transaction, thanks for your suggestion!

@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch from 79d8783 to c7cd13c Compare December 16, 2025 02:01
@hsiangkao
Copy link
Member Author

@dmcgowan @fuweid @azr @AkihiroSuda @cpuguy83
could we have another review of this? thanks!

@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch 2 times, most recently from e8502d4 to f5400b5 Compare December 16, 2025 02:50
Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although it doesn't look like it's being tested.

@hsiangkao
Copy link
Member Author

hsiangkao commented Dec 16, 2025

LGTM, although it doesn't look like it's being tested.

I tried, but then I found SnapshotterSuite cannot specify a given mount handler (i.e. erofs mount handler) due to withMountManager() in core/snapshots/testsuite/testsuite.go without WithMountHandler(), but fsmerge feature should work with erofs mount handler (or runtimes which can handle erofs mounts properly)

I'm not sure how to handle this easily, could we address the tests later?

Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@github-project-automation github-project-automation bot moved this from Needs Reviewers to Review In Progress in Pull Request Review Dec 29, 2025
EROFS has supported a tiny metadata-only image to reference external
blobs since Linux 5.16. This eliminates the need to mount each EROFS
layer one by one and is also useful for VM-based containers (e.g.
nerdbox and Kata containers.)

Similar to LCOW/CimFS, `snapshots.UnpackKeyPrefix` is used to
trigger fsmerge generation (typically < 100 ms) on demand in Prepare().

In the future, we can also generate fsmeta in Commit() of the final
unpacking layer (by introducing an annotation to keep the chainID).
However, in the case of intermediate layer reuse, the Prepare() handling
will still be required.

```toml
[plugins."io.containerd.snapshotter.v1.erofs"]
  max_unmerged_layers = 1      # enable fsmerge if image layers >= 2
```

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
@hsiangkao hsiangkao force-pushed the erofs-snapshotter-fsmerge branch from f5400b5 to 9a7500a Compare December 29, 2025 09:39
@AkihiroSuda AkihiroSuda added this pull request to the merge queue Dec 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 30, 2025
@AkihiroSuda AkihiroSuda added this pull request to the merge queue Dec 30, 2025
Merged via the queue into containerd:main with commit 31594c0 Dec 30, 2025
90 of 92 checks passed
@github-project-automation github-project-automation bot moved this from Review In Progress to Done in Pull Request Review Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

8 participants