Files
erofs-freebsd-out-tree/docs/pre10-batch-a.md
T
2026-08-18 09:20:44 +02:00

4.6 KiB

Pre10 Batch A: Compatibility Cleanup and Ordering

Scope and baseline

Batch A changes only src/internal.h, src/data.c, and src/zmap.c. It is a source-only structural change based on commit b5d6f5ce0696407f9f1cb3f0a9f8cbab643eea49. No QEMU or feature test was run.

The starting blobs were:

Path Blob
src/internal.h cfa15de12b73319322ebb33049a7f14b9eb5c271
src/data.c fdc138b0dad12501d842bae124c8c020793dbc97
src/zmap.c 51170741a0fb5eced814db898c1a233e8a23088a

Removed compatibility declarations

Repository-wide fixed-string searches covered all files below repo-pre-10, including source, the Makefile, and documentation. The only non-definition match was an old review report describing erofs_is_fileio_mode() as dead code.

Candidate Source consumers Result
EROFS_SYNC_DECOMPRESS_AUTO and related enum values 0 Removed
EROFS_ZIP_CACHE_DISABLED and related enum values 0 Removed
struct erofs_buf 0 Removed
__EROFS_BUF_INITIALIZER 0 Removed
erofs_map_blocks.buf 0 Removed with its dead type
erofs_is_fileio_mode() 0 Removed

These declarations modeled Linux facilities that the synchronous contiguous- buffer FreeBSD path does not implement. Their removal does not replace or alter the mount-owned decoded LZMA extent cache introduced in Pre9.

Declaration and definition order

internal.h now exposes explicit groups for buffer/device I/O, inode/vnode lifecycle, directory operations, logical mapping/file data, compressed mapping/data, compression configuration/backends, and VOP vectors. Existing signatures are unchanged.

In data.c, the regular-file wrapper now precedes the symlink wrapper, matching the header's file-data grouping. Both wrappers retain their original bodies and continue to delegate to erofs_read_uio().

In zmap.c, z_erofs_read_extent() now follows the overflow-safe extent position helpers it consumes. The Linux-shared compressed-index and map functions retain their existing relative order; FreeBSD-only explicit-extent helpers remain one contiguous responsibility group.

The reordering was deliberately bounded by the existing static call topology:

  • erofs_check_device_range() remains before erofs_map_dev();
  • erofs_inline_tail_start() and erofs_map_blocks_chunk() remain before erofs_map_blocks();
  • erofs_bread_device() remains before erofs_bread() and erofs_read_physical();
  • erofs_read_uio() remains before both public vnode read wrappers;
  • compressed-index decode/load helpers remain before their callers;
  • z_erofs_map_blocks_fo() and z_erofs_validate_extent_table() remain before z_erofs_fill_inode(); and
  • fill, full/explicit mapping, and sanity helpers remain before z_erofs_map_blocks_iter().

No extra static prototype was introduced. Broader movement of erofs_map_dev() was rejected in this batch because matching Linux's exact position would either violate the current dependency order or add a prototype solely to support cosmetic movement.

Preserved behavior

  • No function signature, return value, allocation flag, lock operation, bread/brelse ownership, mapping flag, or control-flow statement changed.
  • No structure field used by runtime code moved or changed.
  • The Pre9 decoded extent cache fields, initialization/finalization calls, key, lock, and one-entry-per-mount policy are untouched.
  • No Linux page, folio, bio, workqueue, XArray, shrinker, or compatibility wrapper was introduced.

Static validation

Check Result Evidence
Removed-symbol search PASS Every removed enum, type, initializer, helper, and map_blocks.buf access has zero source/Makefile matches.
Prototype uniqueness PASS Each of the 25 grouped cross-file declarations occurs exactly once in internal.h.
erofs_read_file() body PASS Parent and working-tree normalized hashes are both acc4cb05f9a1eb4a0066f8e4d6f3e84c8a69cfb70c762233a61ab08e84836aef.
erofs_readlink_target() body PASS Parent and working-tree normalized hashes are both 73cc37f21f0c66a2c6bb27d39cc9f93f38df1994c7d386dacb5efc7734aa6a89.
z_erofs_read_extent() body PASS Parent and working-tree normalized hashes are both 9145b1220329a2d113c69971c94537a99467a7252f3ea564b695a4530ea8e11d.
Changed-path allowlist PASS Only the three source files and this Batch A report changed.
git diff --check PASS No whitespace errors.
QEMU/build NOT RUN Reserved for final aggregate Pre10 validation.

The final Pre10 guest build and smoke run are intentionally deferred to the aggregate validation stage defined by planning/pre10/validation.md.