# dm-log-writes: queue boundaries, not a disk simulator

Original Hesela JavaScript example, 2026-12-01. No kernel module was loaded, no device was formatted and no filesystem or power-loss experiment was run.

## Reproduce

Run `node --test model.test.mjs`. Import `example()` from `model.mjs` to obtain the seven displayed rows. Tests include 60 admissible completion/flush event orders checked against an independent position-based oracle.

## Model contract

Events are explicitly ordered target callbacks, not application calls. Ordinary write/discard completions enter a pending list. Flush mapping captures that list; flush completion queues only that captured batch and its own record. FUA completion queues itself. A mark appends an annotation without moving pending entries.

All modeled requests succeed. Logging remains enabled. We exclude combined PREFLUSH+FUA flags, failures, payload contents, sectors, kernel scheduling, physical cache behavior, teardown and log-device I/O. The output is the logical logger queue, not evidence that bytes reached either physical device. Invalid event fields, duplicate request IDs and unmatched completions are rejected. Outstanding requests remain explicit.

The example ends with B, F, mark:checkpoint in the logger queue and A pending, although both writes completed. No sampled population, empirical rate or confidence interval is involved.

## Source review

Linux v6.12, commit adc218676eef25575469234709c2d87185ca223a:
- [Documentation](https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/Documentation/admin-guide/device-mapper/log-writes.rst), SHA-256 99a9eab97386d9a372f5f8467f4c6ff1486ad7d5de030f00c02a23543159cb35.
- [Implementation](https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/drivers/md/dm-log-writes.c), SHA-256 1aae23831422ef2399d81b8f5405358ffca3c47eda645edf6b7f38d4f31e59a2.
- Mapping lines 669-674/706-710 and completion lines 717-738 determine batch membership.
- Mark lines 549-571 does not drain pending writes; teardown lines 573-594 does.
- The opening comment's example places late b before the flush. For its stated callback ordering, the executable list operations leave b pending while c,a,flush,d are queued. This is a static comment/implementation discrepancy at the pinned revision, not a claim of a current kernel bug.
- normal_end_io does not inspect its error argument; logging status and lower-device success need independent evidence. These failure paths are outside the success-only model.

Mohan, Martinez, Ponnapalli, Raju and Chidambaram, *Finding Crash-Consistency Bugs with Bounded Black-Box Crash Testing*, OSDI 2018, pp. 33-50, sections 4.4 and 5.1. [Paper](https://www.usenix.org/system/files/osdi18-mohan.pdf), SHA-256 9c40ba65270483ab7802ffc32acb1860b1f9f19d541309ea721415def2d46128. This review uses its separation of replay, syscall history and persisted-object checking; it does not rerun the paper's experiments. No DOI was inferred. Accessed 2026-12-01.

Upstream Linux source retains GPL-2.0-only; paper and documentation retain their rights. Source captures are private research evidence, not redistributed in these original artifacts.
