# Pre5 Extraction Baseline

## Repository Baseline

- Outer starting commit: `6421919003ecfab5317dfa70959ab81cd9bbc990`
- Starting `repo-pre-5` tree: `f99462eee8898af209332ef202f8da07f2dd567e`
- Starting `repo-pre-5/src/super.c` blob: `c150d795df42ae4136fbd6e74c3b88903341b05a`
- Execution target: the existing `repo-pre-5` directory
- Source allowlist for the later extraction commits: `repo-pre-5/src/super.c`

The fixed tree and blob identifiers above were read from Git before this
document was created. Pre5 works directly on `repo-pre-5`; it does not create
another snapshot.

## Stage Scope

Pre5 is an L2-S private cleanup responsibility extraction stage. It has two
source tasks:

1. Extract the existing extra-device cleanup from `erofs_sb_free()` into
   `static void erofs_free_dev_context(struct erofs_mount *em)`.
2. Extract the existing metabox and packed-inode cleanup from
   `erofs_sb_free()` into
   `static void erofs_drop_internal_inodes(struct erofs_mount *em)`.

Both tasks are statement movement only. They must preserve FreeBSD GEOM,
vnode, allocation, and ownership semantics. They must not change behavior,
ABI, features, error handling, locking, logging, conditions, release calls, or
object ownership.

## Protected Paths

The following paths must remain unchanged during Pre5 execution:

- `repo-pre-3/`
- `repo-pre-2/`
- `repo-pre-1/`
- `src-linux/`
- `planning/reject/`
- existing reports and other planning stages

Except for this baseline document, no path outside
`repo-pre-5/src/super.c` belongs in the Pre5 source commits.

## Cleanup-Order Invariant

The effective cleanup order must remain exactly:

```text
xattr prefixes
-> metabox
-> packed inode
-> extra devices in reverse order
-> primary device
-> mount state
```

The extraction must not add pointer clearing, conditions, assertions, logs,
locks, return values, error handling, or header declarations.

## Commit and Push Discipline

Each Pre5 commit must contain one planned logical task and must be pushed
immediately to `xdm main`. The commits must not be squashed. Execution must
stop if a push fails or if local, tracking, and remote commit identities
diverge.

## Validation Status at Baseline

| Validation item | Status |
|---|---|
| Static Git baseline capture | RECORDED |
| Source extraction tasks | NOT RUN |
| Build with `WITH_ZSTDIO=0` | NOT RUN |
| Build with `WITH_ZSTDIO=1` | NOT RUN |
| QEMU smoke testing | NOT RUN |
| Manual or automated tests | NOT RUN |

No build, QEMU run, feature validation, regression test, or runtime result is
claimed by this document.
