# dm-striped address mapping

This constructed example checks Linux v6.12 striped-target address arithmetic.
It does not create a block device, run a storage benchmark or prove that a
device-mapper table is loadable. No measured hardware results are included.

All addresses are integer 512-byte sectors. The target starts at sector 1024,
contains 48 sectors, and has three destinations with backing offsets 128, 256
and 384. The chunk is 8 sectors (4 KiB); this is not a claim that 4 KiB meets
the documented PAGE_SIZE minimum on every system.

| Logical sector | Target-relative sector | Destination (zero-based) | Backing sector |
| --- | --- | --- | --- |
| 1024 | 0 | 0 | 128 |
| 1031 | 7 | 0 | 135 |
| 1032 | 8 | 1 | 256 |
| 1040 | 16 | 2 | 384 |
| 1048 | 24 | 0 | 136 |
| 1071 | 47 | 2 | 399 |

For relative sector x, chunk C and N destinations:
q = floor(x/C); destination = q mod N;
backing sector = offset[destination] + floor(q/N)*C + (x mod C).

Download the [mapping module](./model.mjs) and its
[independent tests](./model.test.mjs) into the same directory.

Run with Node.js 22 or later:

```sh
node --test model.test.mjs
```

The independent test oracle enumerates stripe rounds, destinations and chunk
positions instead of repeating the division formula. Tests also cover one
destination, non-power-of-two geometry, nonzero target start, exact large
integer addresses, and invalid inputs. The model intentionally does not
validate backing-device sizes, logical-block alignment or PAGE_SIZE.

## Destination slots are not device identities

With two destinations, 8-sector chunks, a 16-sector segment starting at 0,
and offsets [128, 128], logical sectors 0 and 8 map to slots 0 and 1,
respectively, both at backing sector 128. If those slots refer to the same
underlying block device, the addresses alias. The test checks this arithmetic;
it does not load such a table or resolve real device identities. Uniqueness
of (slot, sector) pairs is therefore not proof of unique physical locations,
independent failure domains, or protection against overlapping configuration.

Primary sources, reviewed 2026-12-01:
- https://docs.kernel.org/6.12/admin-guide/device-mapper/striped.html
- https://github.com/torvalds/linux/blob/v6.12/drivers/md/dm-stripe.c
- https://github.com/torvalds/linux/blob/v6.12/include/linux/device-mapper.h
- https://github.com/torvalds/linux/blob/v6.12/include/linux/blk_types.h
- https://github.com/torvalds/linux/blob/v6.12/drivers/md/dm-table.c

Interpretation: this target supplies placement, not parity, mirroring,
independent physical failure domains or a throughput multiplier.
