# Which bytes does journal validation cover?

A checksum can validate recorded metadata without validating newly referenced
file data. Linux v6.12 distinguishes metadata-only `data=ordered` and
`data=writeback` from full `data=journal`. Ordering and checksum coverage are
different protections. [1]

OptFS section 2.2 explains a composition trap: allowing data and journal
metadata to proceed together, and separately allowing checksummed journal
metadata and commit to proceed together, does not justify removing both
dependencies. Metadata and commit could survive without the new data. Section
4.3.3 extends coverage to data; full OptFS additionally needs checkpoint,
release and reuse rules. [2]

## Inspect the counterexample

This teaching model uses D (new file data), JM (journal metadata), and JC
(commit record). A bit is 1 only when the expected new bytes persist.
It assumes a single append/allocation, distinguishable old bytes, untouched
old metadata and ideal collision-free comparisons.

| D JM JC | Metadata check accepts | Data-covered check accepts |
| --- | --- | --- |
| 0 0 0 | no | no |
| 0 0 1 | no | no |
| 0 1 0 | no | no |
| 0 1 1 | yes: unsafe reference | no |
| 1 0 0 | no | no |
| 1 0 1 | no | no |
| 1 1 0 | no | no |
| 1 1 1 | yes | yes |

The eight rows are possibilities, not probabilities. No state is assigned a
frequency. This is neither a CRC implementation nor a Linux crash test.
Overwrites, reuse, later transactions, torn writes, checksum collisions and
checkpoint writes are excluded. Rejecting replay does not reconstruct data.

## Reproduce

With Node.js, run `node model.mjs --check` and `node --test model.test.mjs`.
Use `node model.mjs` to print the enumeration. No dependencies or device access.

- [Executable model](model.mjs)
- [Regression tests](model.test.mjs)
- [Generated results and assumptions](results.json)
- [Journal checksum record](https://hesela.dev/terms/journal-checksum/)
- [Optimistic crash consistency](https://hesela.dev/terms/optimistic-crash-consistency/)

## Primary sources

[1] [Linux v6.12 ext4 administration guide, Data Mode and journal_async_commit](https://docs.kernel.org/6.12/admin-guide/ext4.html).
[2] [Chidambaram, Pillai, A. C. Arpaci-Dusseau and R. H. Arpaci-Dusseau,
Optimistic Crash Consistency, SOSP 2013, sections 2.2 and 4.3.3](https://research.cs.wisc.edu/adsl/Publications/optfs-sosp13.pdf).
DOI: 10.1145/2517349.2522726. Sources accessed 2026-12-04.

Historical protocol explanation, not a recommendation to disable storage barriers.
