daemon: skip fsck_snapshot on freshly-created system overlays
The fsck_snapshot lifecycle step exists to repair stale bitmaps in a COW file reused from a prior aborted start — without it, the later e2cp/e2rm calls in patch_root_overlay refuse to touch the snapshot. On a freshly-created COW there are no stale bitmaps to repair, so e2fsck -fy is pure overhead. system_overlay already tracks whether it created the file this run (sc.systemOverlayCreated, used to drive the rollback path). Reuse that flag to skip e2fsck entirely on the create-fresh path. The reused-COW path keeps the fsck for safety. Saves a few hundred ms per VM create — small absolute win on top of the lazy-mkfs change, but free. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
74a2d064fd
commit
b8c48765fb
1 changed files with 10 additions and 4 deletions
|
|
@ -237,12 +237,18 @@ func (s *VMService) buildStartSteps(op *operationLog, sc *startContext) []startS
|
|||
},
|
||||
},
|
||||
{
|
||||
// See the comment in the prior inline version: stale
|
||||
// bitmaps from a reused COW make e2cp/e2rm refuse to
|
||||
// touch the snapshot. e2fsck -fy is a no-op on a fresh
|
||||
// snapshot. Exit codes 0 + 1 are both "ok" here.
|
||||
// e2fsck protects against stale bitmaps in a COW reused
|
||||
// from a prior aborted start — without it, e2cp/e2rm in
|
||||
// patch_root_overlay refuse to touch the snapshot. On a
|
||||
// freshly-created COW (system_overlay just truncated +
|
||||
// created the file this run) there are no stale bitmaps
|
||||
// to repair and e2fsck is pure overhead. Skip it in that
|
||||
// case. Exit codes 0 + 1 are both "ok" when we do run it.
|
||||
name: "fsck_snapshot",
|
||||
run: func(ctx context.Context, sc *startContext) error {
|
||||
if sc.systemOverlayCreated {
|
||||
return nil
|
||||
}
|
||||
return s.privOps().FsckSnapshot(ctx, sc.live.DMDev)
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue