# dm-linear address translation

This constructed example checks address arithmetic, not a loaded device,
hardware throughput, failure tolerance or kernel table acceptance.
No block devices or filesystems are opened or changed.

For logical start S, length N, backing offset O and sector L in [S, S + N),
the destination is O + (L - S). Units are 512-byte sectors. Device capacity,
alignment, sector_t limits and other kernel constraints are outside this model.

The corpus example uses S=1024, N=16 and O=128: 1024 maps to 128,
1039 maps to 143, and 1040 is outside the entry. Two logical entries may name
the same backing sectors; 32 logical addresses in the alias test cover only
16 distinct sectors of the same backing device. That is not a mirror.

Run with a Node.js version supporting the built-in test runner:
```sh
node --test model.test.mjs
```

- [Model](./model.mjs)
- [Boundary, enumeration and alias tests](./model.test.mjs)
- [Definition and sources](https://hesela.dev/terms/dm-linear/)
- [Linux v6.12 implementation](https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/drivers/md/dm-linear.c)

The tests use exact BigInt arithmetic, including values beyond JavaScript's
safe-integer range. They deliberately reject Number inputs. Aliasing is a
mapping deduction, not a claim of immediate buffered-read coherence.
