diff --git a/docs/block/README.md b/docs/block/README.md
index 7f659e9..8a32b59 100644
--- a/docs/block/README.md
+++ b/docs/block/README.md
@@ -49,9 +49,10 @@ The relevant directories are `block/` (core, blk-mq, schedulers), `drivers/nvme/
5. **[I/O Schedulers](io-schedulers.md)** — BFQ, mq-deadline, and Kyber: what each optimizes for
6. **[Block Cgroup (I/O Control)](blk-cgroup.md)** — dividing a device's bandwidth between cgroups
7. **[NVMe Driver](nvme.md)** — how a real modern driver plugs into blk-mq via submission/completion queues
-8. **[Device Mapper: dm-verity](dm-verity.md)** — stacking a virtual block device for integrity verification
-9. **[Observability](block-observability.md)** — seeing what the block layer is doing, from counters to blktrace
-10. **[War Stories](war-stories.md)** — real block-layer bugs and what they taught
+8. **[Device Mapper: Core and Targets](device-mapper.md)** — how a virtual block device is built from a table, with the linear, thin and cache targets
+9. **[Device Mapper: dm-verity](dm-verity.md)** — stacking a virtual block device for integrity verification
+10. **[Observability](block-observability.md)** — seeing what the block layer is doing, from counters to blktrace
+11. **[War Stories](war-stories.md)** — real block-layer bugs and what they taught
### What you'll learn
@@ -73,6 +74,7 @@ The relevant directories are `block/` (core, blk-mq, schedulers), `drivers/nvme/
| [I/O Schedulers](io-schedulers.md) | BFQ, mq-deadline, and Kyber |
| [Block Cgroup (I/O Control)](blk-cgroup.md) | Dividing device bandwidth per cgroup (`io.max` / `io.weight` / `io.latency`) |
| [NVMe Driver](nvme.md) | PCIe SSD architecture, submission/completion queues, blk-mq integration |
+| [Device Mapper: Core and Targets](device-mapper.md) | Tables, the bio path, suspend and swap, and the linear, thin-provisioning and cache targets |
| [Device Mapper: dm-verity](dm-verity.md) | Merkle-tree block integrity verification (Android, ChromeOS) |
| [Observability](block-observability.md) | `/proc/diskstats`, `blktrace`, and BPF for block I/O |
| [War Stories](war-stories.md) | Real block-layer incidents and their lessons |
diff --git a/docs/block/device-mapper.md b/docs/block/device-mapper.md
new file mode 100644
index 0000000..de605a9
--- /dev/null
+++ b/docs/block/device-mapper.md
@@ -0,0 +1,906 @@
+# Device Mapper: The Core and Three Targets
+
+> How the kernel builds a virtual block device from a table of ranges, and what the linear, thin-provisioning and cache targets do with it
+
+Source links point at [Linux v7.3][v73], the tree this page was checked against. Release numbers are mainline releases. Dates are author dates for commits and the dates shown on the page for LWN postings.
+
+**Find your way**
+
+| To learn | Go to |
+|---|---|
+| what a table, a target and a mapped device are | [What it is](#what-it-is) |
+| how a table is loaded, swapped and resumed | [Two tables: load, then swap](#two-tables-load-then-swap) |
+| how one bio becomes clones | [The I/O path](#the-io-path-for-bio-based-devices) |
+| what the three targets have in common and where they differ | [The three targets side by side](#the-three-targets-side-by-side) |
+| how thin provisioning allocates, snapshots and runs out of space | [thin provisioning](#thin-provisioning), [Running out of space](#running-out-of-space) |
+| how the cache decides what to keep | [cache](#cache) |
+| where each part came from | [Where it came from](#where-it-came-from) |
+
+## What it is
+
+A device-mapper device is a block device whose I/O is handled by the device-mapper core instead of a hardware driver. What the device does with an I/O is set by its *table*: a list of ranges of the device's sectors, each handled by a *target*. A range is added with a start, a length, a target type name and a parameter string ([`dm_table_add_target()`][dmt670]), and the target's constructor receives the parameters split into arguments ([dm-table.c:743-749][dmt743]).
+
+```
+ mapped device (one gendisk, one table)
+ ┌─────────────────────┬───────────────────────────────┐
+ │ sectors 0 - 999 │ sectors 1000 - 4999 │
+ │ target: linear │ target: linear │
+ │ /dev/sda, offset 0 │ /dev/sdb, offset 2048 │
+ └─────────────────────┴───────────────────────────────┘
+```
+
+The diagram is an illustrative table; both ranges use the [`linear` target](#linear-the-smallest-target).
+
+!!! example "The same idea in the kernel documentation"
+ The documentation's example script joins two devices with this table. Each line is a start, a length, a target type and its arguments ([linear.rst:28-33][linearrst28]):
+
+ ```
+ 0 $size1 linear $1 0
+ $size1 $size2 linear $2 0
+ ```
+
+Where a mapped device sits when a bio arrives:
+
+```
+ any submitter of a bio
+ │ bio
+ ▼
+ ┌────────────────────────────────┐
+ │ mapped device │ dm_submit_bio, then __split_and_process_bio:
+ │ (device-mapper core) │ finds the target for the sector,
+ │ │ makes a clone of the bio
+ └───────────────┬────────────────┘
+ │ clone
+ ▼
+ ┌────────────────────────────────┐
+ │ target: linear, thin, cache... │ map(): sets a device and a sector, or
+ │ │ takes the clone over
+ └───────────────┬────────────────┘
+ │ remapped clone, submitted with submit_bio_noacct()
+ ▼
+ lower block device(s)
+```
+
+The steps are the ones in [dm.c:2080-2099][dm2080] (find the table, split and process), [dm.c:1736][dm1736] and [dm.c:1767][dm1767] (find the target, allocate the clone), [dm.c:1435][dm1435] (the target's `map`) and [dm.c:1386][dm1386] (submit the remapped clone).
+
+A device is either *bio-based* or *request-based* (see [below](#bio-based-and-request-based-devices)). A bio-based device gets `dm_submit_bio()` as its `.submit_bio` ([dm.c:3804][dm3804]); a request-based device gets a different set of operations ([dm.c:2610][dm2610]) that has no `.submit_bio` ([dm.c:3816-3823][dm3816]). Unless a section says otherwise, this page describes bio-based devices.
+
+[dm-verity](dm-verity.md) and [dm-crypt](../security/dm-crypt.md) are other targets and have their own pages. This page covers the core and three targets that show its range.
+
+!!! info "Terms used on this page"
+ - **bio**: the block layer's I/O descriptor; see [bio and request structures](bio-request.md).
+ - **clone**: a copy of a bio made by the core, usually for one target (the clones of an empty flush in a bypass table have none), made with `bio_alloc_clone()`. The first clone of an I/O is allocated together with its `dm_io` ([dm.c:577][dm576]); later ones are allocated separately ([dm.c:626][dm626]).
+ - **flush and FUA**: `REQ_PREFLUSH` is a "request for cache flush" ([blk_types.h:395][blk395]) and `REQ_FUA` is "forced unit access" ([blk_types.h:394][blk394]). `op_is_flush()` is true for either ([blk_types.h:469-472][blk469]).
+ - **`REQ_NOWAIT` and read-ahead**: `REQ_NOWAIT` means "Don't wait if request will block" ([blk_types.h:398][blk398]); `REQ_RAHEAD` means "read ahead, can fail anytime" ([blk_types.h:396][blk396]).
+ - **SRCU**: a read-side locking scheme whose readers may sleep; see [SRCU](../locking/srcu.md). The core uses it to find out when no thread is still using an old table.
+ - **gendisk**: the kernel's structure for a disk; each mapped device owns one ([dm-core.h:78][core78]).
+
+How the core's objects point at each other:
+
+```mermaid
+flowchart LR
+ MD["mapped_device
gendisk
deferred bio list"]
+ T["dm_table
type, index, highs[ ]
targets[ ]"]
+ TG["dm_target
begin, len
private"]
+ TT["target_type
ctr, map, end_io, ..."]
+ DD["dm_dev
bdev, mode"]
+ MD -- "map (__rcu pointer,
read under SRCU or RCU)" --> T
+ T -- "one per range" --> TG
+ TG -- "type" --> TT
+ T -- "devices list
(via dm_dev_internal)" --> DD
+```
+
+The `mapped_device` holds the table pointer, the disk and the list of deferred bios, which holds the bios that arrived during a suspend ([dm.c:669-676][dm669]) and also re-queued I/O ([dm.c:887][dm887]) ([dm-core.h:60][core60], [dm-core.h:78][core78], [dm-core.h:97][core97]). A `dm_table` holds its type, the index, the `highs` and `targets` arrays and the list of devices it uses ([dm-core.h:189-217][core189]). A `dm_target` has its table, its type and a `private` pointer for the target's own state ([device-mapper.h:312-318][dmh312], [device-mapper.h:358][dmh358]); a `dm_dev` is what `dm_get_device()` returns ([device-mapper.h:173-179][dmh173]); the table's list holds one `dm_dev_internal` per device, which has a reference count and a pointer to its `dm_dev` ([dm.h:41-45][mdh41], [dm-table.c:388-395][dmt388]).
+
+The core keeps its own structures private. The header says that targets "must \_not\_ deference a mapped_device or dm_table to directly access their members" ([dm-core.h:35-39][core35]).
+
+## The control interface
+
+Userspace manages devices through a misc device whose node is `mapper/control` ([dm-ioctl.c:2299-2302][ioc2299]). The commands are a table of ioctl handlers ([dm-ioctl.c:1985-2008][ioc1985]).
+
+| Command | Handler | What the handler does |
+|---|---|---|
+| `DM_DEV_CREATE` | `dev_create` | Creates the mapped device and adds it to the device hash ([dm-ioctl.c:977-981][ioc977]) |
+| `DM_TABLE_LOAD` | `table_load` | Builds a table and stages it as the inactive table ([dm-ioctl.c:1639-1689][ioc1639]) |
+| `DM_DEV_SUSPEND` | `dev_suspend` | Suspends the device if `DM_SUSPEND_FLAG` is set, otherwise resumes it ([dm-ioctl.c:1363-1368][ioc1363]) |
+
+The table also lists commands to remove and rename a device, to read device and table status, to wait for an event, to clear a table, and to send a message to a target. The interface is versioned; the kernel refuses a caller whose major version differs from its own or whose minor version is newer ([dm-ioctl.c:2034-2035][ioc2034], major 4 at [dm-ioctl.h:293][ioh293]).
+
+## Two tables: load, then swap
+
+A device with no live table fails the bios submitted to it: `dm_submit_bio()` calls `bio_io_error()` ([dm.c:2081-2085][dm2081]).
+
+Loading a table does not change the live one. `table_load()` creates a table, adds every target to it with `populate_table()` ([dm-ioctl.c:1639-1645][ioc1639]), and stores it as the device's new, inactive map ([dm-ioctl.c:1687-1689][ioc1687]). A second load replaces a staged table that was never resumed ([dm-ioctl.c:1702-1705][ioc1702]). Completing a table decides its type, builds the sector index, builds the crypto profile (only when the kernel is built with `CONFIG_BLK_INLINE_ENCRYPTION`; otherwise [that step is a stub][dmt1481]) and allocates the memory pools for clones ([`dm_table_complete()`][dmt1505]).
+
+The swap happens on resume. When a table is staged, `do_resume()` suspends the device if it is not already suspended ([dm-ioctl.c:1284-1286][ioc1284]), calls `dm_swap_table()` ([dm-ioctl.c:1311][ioc1311]), and then resumes it ([dm-ioctl.c:1331-1333][ioc1331]). With no staged table it only resumes ([dm-ioctl.c:1274][ioc1274]).
+
+```mermaid
+flowchart LR
+ L["DM_TABLE_LOAD
build table, run each target's ctr
stage as inactive
live table unchanged"]
+ S["suspend
presuspend hooks
freeze filesystem (optional)
block new bios, wait for in-flight bios"]
+ W["swap
the new table becomes live
wait for readers of the old one"]
+ R["resume
target resume hooks
replay queued bios"]
+ L --> S --> W --> R
+```
+
+**Suspend.** `__dm_suspend()` calls the targets' `presuspend`. If the caller asked for a filesystem freeze and did not ask for no-flush, it then calls `lock_fs()`, which freezes the filesystem on the device ([dm.c:2942][dm2942]) and, per its comment, "flushes I/Os and waits for them to complete" ([dm.c:2987-3001][dm2987], condition at [dm.c:2995][dm2995]; the freeze is skipped when userspace passes `DM_SKIP_LOCKFS_FLAG`, checked in the suspend path at [dm-ioctl.c:1224][ioc1224] and in the resume path, which also suspends for a table swap, at [dm-ioctl.c:1280-1281][ioc1280]). It then sets `DMF_BLOCK_IO_FOR_SUSPEND`, waits with `synchronize_srcu()` for any thread still inside the map path, flushes the device's workqueue, and waits for in-flight I/O to finish ([dm.c:3014-3035][dm3014]).
+
+!!! note "What happens to bios during a suspend (bio-based)"
+ While `DMF_BLOCK_IO_FOR_SUSPEND` is set, `dm_submit_bio()` queues ordinary bios on a list. A `REQ_NOWAIT` bio fails with `bio_wouldblock_error()` and a read-ahead bio fails with `bio_io_error()` ([dm.c:2089-2097][dm2089]). A request-based device stops its request queue instead ([dm.c:3022-3025][dm3022]), and the deferred requests wait in that queue ([dm.c:3128][dm3128]).
+
+**Swap.** `dm_swap_table()` refuses to run unless the device is suspended ([dm.c:2889][dm2889]). Unless it keeps the existing limits (a table with no data devices while a live table exists, or a noflush suspend of an immutable request-based device), it computes the queue limits for the new table ([dm.c:2900-2918][dm2900]); `__bind()` then publishes the table with `rcu_assign_pointer()` and waits for readers of the old one ([dm.c:2529-2534][dm2529]).
+
+**Resume.** `__dm_resume()` resumes the targets ([dm.c:3116-3121][dm3116]), restarts the queued bios, and unlocks the filesystem ([dm.c:3123-3133][dm3123]). The comment gives the order's reason: "Flushing deferred I/Os must be done after targets are resumed so that mapping of targets can work correctly" ([dm.c:3125-3128][dm3125]). `dm_wq_work()` replays the queue with `submit_bio_noacct()` ([dm.c:2855-2865][dm2855]).
+
+## The sector index
+
+A table maps a sector to a target. `dm_table_find_target()` walks an index whose nodes are one cache line wide and hold sector keys ([dm-table.c:30-32][dmt30], [dm-table.c:1565-1583][dmt1565]). A sector past the end of the table returns no target ([dm-table.c:1570-1571][dmt1570]), and the I/O path fails the bio with `BLK_STS_IOERR` ([dm.c:1736-1738][dm1736]).
+
+The index keys are the last sector of each range. `dm_table_add_target()` stores `begin + len - 1` in `highs` ([dm-table.c:754][dmt754]), the leaf level of the index is that array ([dm-table.c:1129][dmt1129]), and the lookup takes the first key that is not smaller than the sector ([dm-table.c:1577-1580][dmt1577]). For the table in the first diagram:
+
+```
+ ranges of the table leaf of the index (highs)
+ targets[0] sectors 0 - 999 highs[0] = 999
+ targets[1] sectors 1000 - 4999 highs[1] = 4999
+
+ lookup of sector 1500: the first key >= 1500 is highs[1], so the target is targets[1]
+```
+
+A larger table adds levels above the leaf; `dm_table_find_target()` walks all `t->depth` levels, the leaf included ([dm-table.c:1573][dmt1573]).
+
+`dm_table_add_target()` rejects a range that has zero length ([dm-table.c:688-691][dmt688]) and a range that does not start where the previous one ended ([dm-table.c:738-741][dmt738]), and a first range that does not start at sector 0 ([dm-table.c:486-487][dmt486]). A target type's feature flags add further rules:
+
+| Feature | Meaning | Where enforced |
+|---|---|---|
+| `DM_TARGET_SINGLETON` | Must be the only target in a table | [dm-table.c:703-709][dmt703] (a singleton added after another target), [dm-table.c:677-681][dmt677] (a target added after a singleton) |
+| `DM_TARGET_ALWAYS_WRITEABLE` | Not allowed in a read-only table | [dm-table.c:711-715][dmt711] |
+| `DM_TARGET_IMMUTABLE` | Cannot be mixed with other target types in one table | [dm-table.c:717-728][dmt717] |
+| `DM_TARGET_IMMUTABLE` | Once a device has it, a later table must use the same type, unless it contains a wildcard target | [dm-ioctl.c:1649-1657][ioc1649] |
+| `DM_TARGET_WILDCARD` | May replace any target, even an immutable one | [device-mapper.h:254-258][dmh254] (definition), [dm-ioctl.c:1650-1652][ioc1650] (the check that lets it replace an immutable target) |
+
+## The I/O path for bio-based devices
+
+A bio reaches the device through `dm_submit_bio()`, which takes the live table under SRCU ([dm.c:2080][dm2080]) and calls `dm_split_and_process_bio()` ([dm.c:2099][dm2099]).
+
+```
+ bio for the mapped device
+ │
+ ▼
+ dm_submit_bio ── no table / suspended ──► error / queue (see above)
+ │
+ ▼
+ dm_split_and_process_bio
+ │ find target for the first sector
+ │ clone the bio, trimmed to the target boundary
+ ▼
+ __map_bio ──► target->map(clone)
+ │
+ ├─ DM_MAPIO_REMAPPED ───┐ core submits the clone to the lower device
+ ├─ DM_MAPIO_SUBMITTED ──┤ target owns the clone
+ │ ▼
+ │ (the clone completes, on the lower device or in the target)
+ │ │
+ │ ▼
+ │ clone_endio ──► target->end_io (optional)
+ │ │
+ │ ▼
+ │ last clone done? ──► original bio completes
+ │
+ └─ KILL / REQUEUE ──► clone freed, status recorded on the I/O
+```
+
+Steps 1 to 4 describe normal reads and writes. A discard, secure-erase or write-zeroes bio is cloned once per copy the target asked for (`num_discard_bios` and the like) by `__process_abnormal_io()` instead of by the single clone in step 1 ([dm.c:1740-1741][dm1740]), then mapped and completed as in steps 3 and 4 ([dm.c:1524-1530][dm1524]). A flush normally goes through `__send_empty_flush()` (see "Flushes and discards" below).
+
+1. **Clone.** `__split_and_process_bio()` finds the target for the current sector ([dm.c:1736][dm1736]) and limits the length to the target's maximum I/O length and the sectors left ([dm.c:1749][dm1749]). `alloc_tio()` supplies the clone: the first one is embedded in the per-I/O structure `dm_io`, later ones come from `bio_alloc_clone()` ([dm.c:620-626][dm620]). The clone's default device is the mapped device itself, so the target must change it before the bio is issued ([dm.c:645-646][dm645]).
+2. **Split.** A bio that crosses a target boundary is handled in pieces. The part that was not mapped is trimmed and resubmitted with `submit_bio_noacct()`, so that it runs "*after* bios already submitted have been completely processed" ([dm.c:2046-2053][dm2046]).
+3. **Map.** `__map_bio()` sets `clone_endio()` as the completion function ([dm.c:1414][dm1414]) and calls the target's `map`; the `linear` and `stripe` targets are called directly, without the function pointer ([dm.c:1430-1435][dm1430]).
+4. **Complete.** `clone_endio()` calls the target's optional `end_io` ([dm.c:1114-1115][dm1114]); if that returns `DM_ENDIO_INCOMPLETE` the target keeps the clone ([dm.c:1134-1136][dm1134]), otherwise the core drops a reference on the `dm_io` ([dm.c:1147-1148][dm1147]). The `dm_io` starts with two references, one for submission and one for completion ([dm.c:590-591][dm590]), and the original bio completes when the last reference is dropped ([dm.c:1047-1055][dm1047]), with two exceptions: a flush with data that was sent as an empty flush first is re-queued without `REQ_PREFLUSH` instead of completing ([dm.c:986-992][dm986]), and an I/O that ends with `BLK_STS_DM_REQUEUE`, or a polled I/O that ends with `BLK_STS_AGAIN`, is either requeued or, for `BLK_STS_DM_REQUEUE` when none of the requeue conditions holds, failed with an I/O error ([dm.c:903-947][dm903]).
+
+**A bio that crosses a target boundary** is mapped in passes. The length of each clone is limited to the end of its target ([dm.c:1161-1166][dm1161]); the rest of the bio is trimmed and submitted again ([dm.c:2046-2053][dm2046]):
+
+```
+ table: target A sectors 0 - 999 │ target B sectors 1000 - 4999
+ bio (illustrative, 400 sectors): sectors 800 - 1199
+
+ first pass clone for sectors 800 - 999 ──► A.map (limited to the end of A)
+ the rest, 1000 - 1199, is trimmed and submitted again
+ second pass clone for sectors 1000 - 1199 ──► B.map
+ done the original bio completes when both clones have completed
+```
+
+The original bio waits for the second pass because the first pass takes an extra reference on it with `bio_inc_remaining()` ([dm.c:2052][dm2052]); each pass ends the bio with `bio_endio()` ([dm.c:997][dm997]).
+
+What `map` returns decides what the core does next ([dm.c:1437-1460][dm1437], values at [device-mapper.h:710-714][dmh710]):
+
+| Return value | Core's action |
+|---|---|
+| `DM_MAPIO_REMAPPED` | Submits the clone to the device the target set, with `dm_submit_bio_remap()` |
+| `DM_MAPIO_SUBMITTED` | The core submits nothing; the target owns the clone and will complete or submit it (the core starts I/O accounting unless the target set `accounts_remapped_io`, [dm.c:1438-1442][dm1438]) |
+| `DM_MAPIO_REQUEUE` | Frees the clone and records `BLK_STS_DM_REQUEUE` as the I/O's status |
+| `DM_MAPIO_KILL` | Frees the clone and records `BLK_STS_IOERR` as the I/O's status |
+
+!!! warning "`DM_MAPIO_DELAY_REQUEUE` is not a bio-based return value"
+ The value is defined next to the others, but the switch in `__map_bio()` has no case for it and ends in `BUG()` ([dm.c:1457-1459][dm1457]). The request-based path handles it ([dm-rq.c:412][rq412]).
+
+**Flushes and discards.** A target asks for the number of copies of a flush, discard, secure-erase or write-zeroes bio it wants, using `num_flush_bios`, `num_discard_bios`, `num_secure_erase_bios` and `num_write_zeroes_bios` ([device-mapper.h:331-349][dmh331]). A flush with data is split into an empty flush followed by the data, except when the table has one underlying device and its targets set `flush_bypasses_map`: then it is passed whole to `__split_and_process_bio()`, and the target's `map` is still called ([dm.c:2013-2043][dm2013], single-device test at [dm.c:2024-2026][dm2024]). The table-wide `flush_bypasses_map` flag is true only when every target sets it ([dm-table.c:763-764][dmt763]); in that case an *empty* flush ignores `num_flush_bios` and is sent as one clone to each underlying device, with no target attached, so it never reaches the targets' `map` or `end_io` ([dm.c:1571-1593][dm1571]). A target that asks for no copies of a discard, secure-erase or write-zeroes bio makes the bio fail with `BLK_STS_NOTSUPP` ([dm.c:1677-1678][dm1677]).
+
+## Bio-based and request-based devices
+
+A table is bio-based, request-based or DAX bio-based ([device-mapper.h:29-34][dmh29]); DAX is the direct-access variant of bio-based. The type comes from the targets: a table that mixes bio-based and request-based targets is rejected ([dm-table.c:925-928][dmt925]). A request-based table must have a single target ([dm-table.c:965-968][dmt965]). Unless the table has no devices, that target must be immutable ([dm-table.c:970-984][dmt970]). A device keeps the type of its first table; a later table of a different type is refused, except that a bio-based device may become DAX bio-based ([dm-ioctl.c:1617-1624][ioc1617], [dm-ioctl.c:1666-1671][ioc1666]).
+
+A request-based target works on `struct request`, through a `clone_and_map_rq` callback ([device-mapper.h:63][dmh63]). The multipath target is the example in the tree. It is a singleton and immutable, implements `clone_and_map_rq` ([dm-mpath.c:2300-2307][mpath2300]) and defaults to request-based; the `queue_mode bio` option makes it bio-based ([dm-mpath.c:240-245][mpath240], [dm-mpath.c:1159-1167][mpath1159]).
+
+The 2008 posting of the request-based series explains the difference: "Mapping is done in a unit of struct request, instead of struct bio" ([LWN, 2008-09-12][lwn298882]). The commit that enabled request-based DM, [`e6ee8c0b7675`][ce6ee8c0b7675] ("dm: enable request based option", Linux 2.6.31, 2009-06-22), gives the reason for keeping both: "there are some target drivers which are more fitting to bio-based dm". It also states the limit that is still in the code: request-based DM supports only tables with a single target.
+
+## The target interface
+
+A target type is a `struct target_type`: a name, a version, feature flags and a set of callbacks ([device-mapper.h:198-228][dmh198]). Where the core calls them:
+
+| Callback | Called by the core |
+|---|---|
+| `ctr` | When the range is added to a table ([dm-table.c:749][dmt749]) |
+| `dtr` | When the table is destroyed ([dm-table.c:195-196][dmt195]) |
+| `map` | For each clone of a bio-based I/O that the core maps to this target (not for an empty flush when every target in the table sets `flush_bypasses_map`, see "Flushes and discards"); `linear` and `stripe` are called directly ([dm.c:1430-1435][dm1430]) |
+| `end_io` | When the clone completes, except for the clones of an empty flush in a table where every target sets `flush_bypasses_map`, which have no target attached ([dm.c:1114-1115][dm1114], [dm.c:1097][dm1097], [dm.c:1589][dm1589]) |
+| `presuspend`, `postsuspend` | Around a suspend ([dm-table.c:2155-2178][dmt2155]) |
+| `preresume`, `resume` | While resuming ([dm-table.c:2179-2205][dmt2179]) |
+
+`status`, `message`, `iterate_devices` and `io_hints` are also members of the struct ([device-mapper.h:215-221][dmh215]). A target's constructor opens the underlying devices with `dm_get_device()` ([device-mapper.h:185-186][dmh185]). Each range has a `struct dm_target` with its `begin`, `len` and optional `max_io_len` ([device-mapper.h:312-321][dmh312]).
+
+Target types are kept in a list under a read-write semaphore ([dm-target.c:18-19][tgt18]). When the named type is missing, the core runs `request_module("dm-%s", name)` and looks again ([dm-target.c:46-49][tgt46], [dm-target.c:51-58][tgt51]).
+
+The feature flags that these targets set, from their `target_type` definitions (`multipath` is included for comparison):
+
+| Target | `SINGLETON` | `IMMUTABLE` | `ALWAYS_WRITEABLE` | Source |
+|---|---|---|---|---|
+| `linear` | ✗ | ✗ | ✗ | [dm-linear.c:202-207][lin202] |
+| `thin-pool` | ✓ | ✓ | ✓ | [dm-thin.c:4109-4112][thin4109] |
+| `thin` | ✗ | ✗ | ✗ | [dm-thin.c:4493-4495][thin4493] |
+| `cache` | ✗ | ✗ | ✗ | [dm-cache-target.c:3556-3571][cache3556] (no `.features`) |
+| `multipath` | ✓ | ✓ | ✗ | [dm-mpath.c:2300-2303][mpath2300] |
+
+The other flags, for example `DM_TARGET_PASSES_CRYPTO` and `DM_TARGET_NOWAIT`, are listed in [device-mapper.h:234-310][dmh234].
+
+## The three targets side by side
+
+| | `linear` | `thin-pool` and `thin` | `cache` |
+|---|---|---|---|
+| Table line | ` ` ([dm-linear.c:28][lin28]) | pool: ` ` ([dm-thin.c:3271-3274][thin3271]); thin: ` [origin_dev]` ([dm-thin.c:4172][thin4172]) | ` <#feature args> []* <#policy args> []*` ([dm-cache-target.c:2025-2027][cache2025]) |
+| Has a metadata device | ✗ | ✓ | ✓ |
+| `map` returns | always `DM_MAPIO_REMAPPED` ([dm-linear.c:96][lin96]) | thin: `REMAPPED` only for a mapped, unshared block that is not held in a cell, `SUBMITTED` otherwise ([dm-thin.c:2731-2808][thin2731]); thin-pool: always `REMAPPED` ([dm-thin.c:3450][thin3450]) | `REMAPPED`, or `SUBMITTED` when the target takes the bio over ([dm-cache-target.c:1674][cache1674], [dm-cache-target.c:1768][cache1768]) |
+| Modes | none | pool modes ([below](#running-out-of-space)) | writeback, writethrough, passthrough ([below](#three-io-modes)); it also has metadata modes `CM_WRITE`, `CM_READ_ONLY` and `CM_FAIL` ([dm-cache-target.c:248-252][cache247]) |
+
+## linear: the smallest target
+
+A `linear` range is ` ` ([dm-linear.c:28][lin28]): the whole range maps onto one device at a fixed offset. The map function sets the device and adds the offset to the position within the range:
+
+```c
+static sector_t linear_map_sector(struct dm_target *ti, sector_t bi_sector)
+{
+ struct linear_c *lc = ti->private;
+
+ return lc->start + dm_target_offset(ti, bi_sector);
+}
+
+int linear_map(struct dm_target *ti, struct bio *bio)
+{
+ struct linear_c *lc = ti->private;
+
+ bio_set_dev(bio, lc->dev->bdev);
+ bio->bi_iter.bi_sector = linear_map_sector(ti, bio->bi_iter.bi_sector);
+
+ return DM_MAPIO_REMAPPED;
+}
+```
+
+*Quoted from [dm-linear.c:82-97][lin82].* It returns `DM_MAPIO_REMAPPED`, so the core submits the clone. The constructor asks for one copy each of flush, discard, secure-erase and write-zeroes bios and sets `flush_bypasses_map` ([dm-linear.c:61-65][lin61]). In a table made only of targets that set `flush_bypasses_map` (`linear` and `stripe` both do), an empty flush is therefore sent to the underlying devices without calling `linear_map()` (see "Flushes and discards").
+
+## thin provisioning
+
+Thin provisioning uses two target types ([dm-thin.c:4109-4110][thin4109], [dm-thin.c:4493-4494][thin4493]):
+
+| | `thin-pool` | `thin` |
+|---|---|---|
+| Role | Owns the storage: a metadata device and a data device split into blocks | One virtual device carved out of a pool |
+| Table line | ` ` and optional features ([dm-thin.c:3271-3281][thin3271]) | ` [origin_dev]` ([dm-thin.c:4172][thin4172]) |
+| Features | Singleton, always writeable, immutable, passes crypto ([dm-thin.c:4111-4112][thin4111]) | Passes crypto ([dm-thin.c:4495][thin4495]) |
+
+!!! example "Creating a pool, a thin device and a snapshot, from the kernel documentation"
+ ```
+ dmsetup create pool \
+ --table "0 20971520 thin-pool $metadata_dev $data_dev \
+ $data_block_size $low_water_mark"
+ dmsetup message /dev/mapper/pool 0 "create_thin 0"
+ dmsetup create thin --table "0 2097152 thin /dev/mapper/pool 0"
+ dmsetup suspend /dev/mapper/thin
+ dmsetup message /dev/mapper/pool 0 "create_snap 1 0"
+ dmsetup resume /dev/mapper/thin
+ ```
+
+ Sources: pool ([thin-provisioning.rst:104-106][thinrst104]), thin device ([thin-provisioning.rst:165-175][thinrst165]), snapshot ([thin-provisioning.rst:192-194][thinrst192]).
+
+The data block size must be at least 64 KB, at most 1 GB, and a multiple of 64 KB ([dm-thin.c:41-46][thin41], [dm-thin.c:3342-3345][thin3342]). According to [the commit that added the target][c991d9fa02da0], many virtual devices are stored on the same data volume, and snapshots can be taken of snapshots (see [Snapshots](#snapshots)). A pool is managed with messages: `create_thin`, `create_snap`, `delete`, `set_transaction_id`, `reserve_metadata_snap` and `release_metadata_snap` ([dm-thin.c:3855-3871][thin3855]).
+
+### Metadata
+
+The file header of the metadata code describes the layout ([dm-thin-metadata.c:20-34][tm20]):
+
+```
+ metadata device (logical components)
+ ┌────────────┬─────────────────────┬───────────────────────┬─────────────────────────┐
+ │ superblock │ space map: │ btree: │ two-level btree: │
+ │ (block 0) │ metadata + data │ thin device id │ (device id, virtual │
+ │ │ blocks │ → device details │ block) → block_time │
+ └────────────┴─────────────────────┴───────────────────────┴─────────────────────────┘
+ block_time = 24-bit time (low bits) + 40-bit data block (high bits)
+```
+
+The header comment puts a superblock in block zero, "taking up fewer than 512 bytes for atomic writes" ([dm-thin-metadata.c:22-23][tm22]), and says the space maps "allocate space linearly from front to back" ([dm-thin-metadata.c:68-69][tm68]). The btrees and space maps come from the persistent-data library, which was added in the same release as thin provisioning ([`3241b1d3e0aa`][c3241b1d3e0aa], "dm: add persistent data library", Linux 3.2, 2011-10-31).
+
+### The path of a bio
+
+`thin_map()` rebases the sector and calls `thin_bio_map()` ([dm-thin.c:4326-4331][thin4326]), which handles the bio when it can and otherwise hands it to the pool's worker thread ([dm-thin.c:2719][thin2719]). To decide, it takes a *cell* on the virtual block (a lock on that block, held by the first bio that reaches it) and looks the block up without issuing metadata I/O ([dm-thin.c:2751-2755][thin2751]).
+
+```mermaid
+flowchart TD
+ A["bio for a thin device"] --> B{"flush, FUA
or discard?"}
+ B -- yes --> W["pool worker"]
+ B -- no --> C{"look up the
virtual block"}
+ C -- "mapped, not shared" --> R["remap to the data block
DM_MAPIO_REMAPPED"]
+ C -- "shared, not mapped,
or lookup would block" --> W
+ W -- "discard" --> X["process_discard"]
+ W -- "other bios" --> D{"block state"}
+ D -- "mapped, not shared" --> R2["remap_and_issue() from the worker
(thin_bio_map() already
returned DM_MAPIO_SUBMITTED)"]
+ D -- "shared, write with data" --> S["break_sharing:
allocate a block,
copy unless whole-block write"]
+ D -- "shared, read
or empty flush" --> RR["remap to the shared block"]
+ D -- "not mapped, read" --> Z["zero-fill, or read
from the external origin"]
+ D -- "not mapped, write with data" --> P["allocate a data block"]
+ D -- "not mapped, empty flush" --> RF["remap without provisioning"]
+ P --> Q{"external
origin?"}
+ Q -- yes --> E["copy from the origin
(not for a whole-block write;
zeroed past the origin's end,
if zeroing is on and the
write is not whole-block)"]
+ Q -- no --> F["zero the block unless the
write covers all of it
or zeroing is off"]
+ S --> M["insert mapping
release held bios"]
+ E --> M
+ F --> M
+```
+
+The lower half of the diagram, from the pool worker down, shows the `PM_WRITE` handlers ([dm-thin.c:2613-2623][thin2613]); the top half is `thin_bio_map()`, which is the same in every mode except that it returns early in requeue mode (a per-thin-device flag) and in `PM_FAIL` ([dm-thin.c:2731-2740][thin2731]). In `PM_OUT_OF_DATA_SPACE`, `PM_OUT_OF_METADATA_SPACE` and `PM_READ_ONLY` the pool uses read-only variants of `process_bio` and `process_cell`, and in the two read-only modes `process_discard` does nothing but complete the bio ([dm-thin.c:2583-2585][thin2583]); the modes are described below. A bio can also be held in the cell because another bio already holds it ([dm-thin.c:2752-2753][thin2752]); the diagram leaves that case out.
+
+The anchors for the diagram:
+
+- Flushes, FUA writes and discards go to the worker ([dm-thin.c:2742-2745][thin2742]). A hit on a mapped, unshared block is remapped ([dm-thin.c:2781-2792][thin2781]). A shared block, or a lookup result of `-ENODATA` or `-EWOULDBLOCK` (`-EWOULDBLOCK`: the lookup would need metadata I/O), goes to the worker ([dm-thin.c:2762-2779][thin2762], [dm-thin.c:2794-2797][thin2794]).
+- A write to a shared block breaks the sharing (an empty flush bio does not: the condition is a write with data, [dm-thin.c:1887][thin1887]); a read of one is remapped to the shared block ([dm-thin.c:1887-1899][thin1887]). `break_sharing()` allocates a new block and copies the old data into it ([dm-thin.c:1799-1812][thin1799]), and the copy is skipped when the write covers the whole block ([dm-thin.c:1335-1339][thin1335]).
+- A read of an unmapped block is filled with zeroes and completed without touching the data device ([dm-thin.c:1923-1928][thin1923]), or, for a thin device created with an external origin (the optional `origin_dev` in the table line, opened read-only, [dm-thin.c:4216][thin4216]), read from the origin when the read lies wholly inside it; a read that straddles the end of the origin is zero-filled and truncated, and the part inside the origin is still read from it, while one wholly past the end is zero-filled and completed without being issued ([dm-thin.c:1977-1992][thin1977]). A write with data allocates a data block ([dm-thin.c:1930][thin1930]); an empty flush is remapped without provisioning ([dm-thin.c:1909-1918][thin1909]). The new block is then filled by copying from the origin if there is one ([dm-thin.c:1933-1934][thin1933]), except that for a block that straddles the end of the origin only the part inside it is copied, and a block wholly past the end is zeroed instead ([dm-thin.c:1415-1426][thin1415]). For the straddling block the tail is zeroed only when zeroing is turned on ([dm-thin.c:1357][thin1356]), and for a block wholly past the end only when zeroing is turned on and the write does not cover the whole block ([dm-thin.c:1396-1404][thin1396]). The copy is skipped for a whole-block write ([dm-thin.c:1335-1339][thin1335]). Without an origin, the block is zeroed unless the write covers all of it or zeroing is turned off ([dm-thin.c:1396-1404][thin1396]).
+- `process_prepared_mapping()` inserts the mapping and releases the held bios ([dm-thin.c:1004-1029][thin1004]).
+
+### When metadata reaches disk
+
+Changes to the mapping sit in an open metadata transaction until `commit()` calls `dm_pool_commit_metadata()` ([dm-thin.c:1490][thin1490]). A bio with a flush or FUA flag is checked when it is issued. If its thin device has changed the transaction by then, including a FUA write that provisioned a block and does not cover all of it, it does not go straight down: `issue()` puts it on a list, and one commit serves all bios on the list ([dm-thin.c:735-738][thin735], [dm-thin.c:756-777][thin756]). The comment on a related path says why: "If the bio has the REQ_FUA flag set we must commit the metadata before signaling its completion" ([dm-thin.c:964-966][thin964]).
+
+```mermaid
+sequenceDiagram
+ participant C as caller
+ participant W as pool worker
+ participant L as deferred_flush_bios
+ participant M as metadata
+ participant D as data device
+ C->>W: write with REQ_FUA (flush and FUA bios go to the worker)
+ W->>L: issue(): the thin device changed this transaction, so queue the bio
+ Note over L: other flush and FUA bios can join the list
+ W->>M: process_deferred_bios(): one commit()
+ M-->>W: committed
+ W->>C: REQ_PREFLUSH bios complete now
+ W->>D: other bios, including this FUA write, are submitted
+```
+
+The pool worker also commits when the transaction has changed and more than `COMMIT_PERIOD` (one second) has passed since the last commit ([dm-thin.c:2386-2387][thin2386], [dm-thin.c:33][thin33], [dm-thin.c:2109-2113][thin2109]). After a commit, a waiting bio that is a `REQ_PREFLUSH` is completed without being sent down, because "The data device was flushed as part of metadata commit"; the others are submitted ([dm-thin.c:2402-2410][thin2402]). A whole-block overwrite with the FUA flag (a flush with data reaches the target with `REQ_PREFLUSH` already cleared, because the core sends the flush first, [dm.c:986-992][dm986]) whose write was issued ahead of the mapping (when zeroing is on, or a copy from the shared block or the external origin is skipped) is already on the data device by then and, if the commit is needed, sits on a second list, `deferred_flush_completions`; after the commit it is completed with `bio_endio()`, not submitted ([dm-thin.c:987-989][thin987], [dm-thin.c:2399-2400][thin2399]).
+
+### Snapshots
+
+`create_snap` makes the snapshot's mapping tree by taking another reference to the origin's tree root: "clone the origin, an inc will do" ([dm-thin-metadata.c:1205-1206][tm1205]). It then bumps the pool's time counter and records it as the *snapshotted time* of both devices ([dm-thin-metadata.c:1218-1224][tm1218], [dm-thin-metadata.c:1174-1178][tm1174]).
+
+A block counts as shared when the time stored with it is older than the device's last snapshot ([dm-thin-metadata.c:1497-1506][tm1497], [dm-thin-metadata.c:1518][tm1518]). A new mapping is stored with the pool's current time ([dm-thin-metadata.c:1648][tm1648]).
+
+```
+ create_snap 1 0 pool time goes from 0 to 1
+
+ device 0 (origin) ──┐ the same tree root R, reference count +1
+ device 1 (snapshot) ──┘ both devices now have snapshotted_time = 1
+
+ vblock 7, on both devices → data block 40, stored with time 0. 0 < 1, so it is shared
+
+ a write to vblock 7 on device 1:
+ break_sharing allocate data block 41, copy block 40 into it (no copy if the write covers the whole block)
+ insert device 1: vblock 7 → block 41, stored with time 1 (1 is not < 1: not shared)
+ result device 0: vblock 7 → 40 device 1: vblock 7 → 41
+```
+
+The numbers are illustrative; the steps are `__create_snap()` ([dm-thin-metadata.c:1205-1224][tm1205]), `break_sharing()` ([dm-thin.c:1799-1812][thin1799], copy skipped for a whole-block write at [dm-thin.c:1338-1339][thin1338]) and the insert in `process_prepared_mapping()` ([dm-thin.c:1009][thin1009]).
+
+!!! warning "Quiesce the origin before taking a snapshot"
+ `thin_bio_map()` has a window between its lookup and snapshot creation. The comment gives the rule that avoids it: "always quiesce the origin before taking the snap" ([dm-thin.c:2764-2773][thin2764]). The kernel documentation says the same: "you must suspend it before creating the snapshot to avoid corruption. This is NOT enforced at the moment" ([thin-provisioning.rst:186-188][thinrst186]).
+
+The commit that added thin provisioning ([`991d9fa02da0`][c991d9fa02da0], Linux 3.2, 2011-10-31) says how it differs from the earlier snapshot implementation: "The previous implementation of snapshots did this by chaining together lookup tables, and so performance was O(depth). This new implementation uses a single data structure so we don't get this degradation with depth."
+
+### Running out of space
+
+The pool has a mode, ordered from healthy to failed ([dm-thin.c:203-214][thin203]).
+
+```mermaid
+stateDiagram-v2
+ direction LR
+ [*] --> PM_WRITE
+ PM_WRITE --> PM_OUT_OF_DATA_SPACE: no free data block, even after a commit
+ PM_OUT_OF_DATA_SPACE --> PM_WRITE: a commit finds free data blocks
+ PM_WRITE --> PM_OUT_OF_METADATA_SPACE: no free metadata block
+ PM_OUT_OF_DATA_SPACE --> PM_OUT_OF_METADATA_SPACE: no free metadata block
+ PM_OUT_OF_METADATA_SPACE --> PM_WRITE: the metadata device is grown
+ PM_WRITE --> PM_READ_ONLY: a metadata operation fails
+ PM_WRITE --> PM_FAIL: aborting the transaction fails
+ PM_FAIL --> PM_FAIL: never left
+```
+
+| Transition | Source |
+|---|---|
+| `PM_WRITE` → `PM_OUT_OF_DATA_SPACE` | `alloc_data_block()` finds no free block after a commit, or the allocation returns `-ENOSPC` ([dm-thin.c:1545-1547][thin1545], [dm-thin.c:1553-1554][thin1553]) |
+| `PM_OUT_OF_DATA_SPACE` → `PM_WRITE` | After a commit, `check_for_data_space()` finds free blocks ([dm-thin.c:1473-1475][thin1473], called from [dm-thin.c:1494-1495][thin1494]) |
+| → `PM_OUT_OF_METADATA_SPACE` | `check_for_metadata_space()` finds no free metadata block, or cannot read the count, and the pool is not already read-only ([dm-thin.c:1449-1458][thin1449]) |
+| → `PM_READ_ONLY` | A metadata operation failed: the transaction is aborted and the mode set ([dm-thin.c:2654-2660][thin2654]) |
+| → `PM_FAIL` | Aborting the transaction, or setting the `needs_check` flag, failed ([dm-thin.c:2643-2651][thin2643]) |
+| out of `PM_FAIL` | Never: "we never let the pool move out of the old mode" ([dm-thin.c:2560-2565][thin2560]) |
+| to `PM_WRITE` when `needs_check` is set | Refused: from another mode the pool stays where it is, and a pool already in `PM_WRITE` is moved to `PM_READ_ONLY` ([dm-thin.c:2548-2558][thin2548]) |
+| `PM_OUT_OF_METADATA_SPACE` → `PM_WRITE` | The pool sets `PM_WRITE` when the metadata device is grown ([dm-thin.c:3537-3538][thin3537]); the source comment says the mode "may switch back to WRITE on metadata resize" ([dm-thin.c:207-209][thin207]) |
+| Table reload | On resume, `pool_preresume()` calls `bind_control_target()` ([dm-thin.c:3573][thin3573]); for a newly loaded table it asks for the mode in the new table's features, `PM_WRITE` by default and `PM_READ_ONLY` with the `read_only` argument, subject to the `needs_check` and `PM_FAIL` rules above ([dm-thin.c:2861-2882][thin2861], [dm-thin.c:2901][thin2901], [dm-thin.c:3175-3176][thin3175]) |
+
+The diagram shows representative edges. `metadata_operation_failed()` sets `PM_READ_ONLY` whatever the current mode, except that `PM_FAIL` is never left ([dm-thin.c:2654-2660][thin2654], [dm-thin.c:2560-2565][thin2560]), and `commit()` refuses to run only from `PM_OUT_OF_METADATA_SPACE` upward ([dm-thin.c:1487-1488][thin1487]), so a commit can also degrade the pool from `PM_OUT_OF_DATA_SPACE`.
+
+What each mode does with a bio:
+
+| Mode | Source comment | Behaviour |
+|---|---|---|
+| `PM_WRITE` | metadata may be changed | Served normally |
+| `PM_OUT_OF_DATA_SPACE` | metadata may be changed, though data may not be allocated | Uses the read-only handlers for bios and cells; discards and prepared mappings keep their write-mode handlers ([dm-thin.c:2602-2607][thin2602]); a bio that is unserviceable is held on a retry list unless `error_if_no_space` is set ([dm-thin.c:1600-1601][thin1600], [dm-thin.c:1614-1623][thin1614]) |
+| `PM_OUT_OF_METADATA_SPACE` | like read-only, but may switch back to write on a metadata resize; reported as read-only | Same bio path as `PM_READ_ONLY` ([dm-thin.c:2580-2587][thin2580]); an unserviceable bio fails with an I/O error ([dm-thin.c:1603-1606][thin1603]) |
+| `PM_READ_ONLY` | metadata may not be changed | A read or write to a mapped block is remapped, except a write with data to a shared block; a discard is completed without being remapped ([dm-thin.c:2583-2586][thin2583]); a read of an unmapped block is zero-filled (or read from the external origin); a write with data to a shared block, and any write to an unmapped block, is unserviceable and fails; an empty flush to a shared block is remapped ([dm-thin.c:2032-2063][thin2032]) |
+| `PM_FAIL` | all I/O fails | Every bio to a thin device fails, except that a thin device in requeue mode ends it with `BLK_STS_DM_REQUEUE` instead ([dm-thin.c:2731-2740][thin2731]); bios to the pool device itself are still remapped to the data device in every mode ([dm-thin.c:3438-3450][thin3438]) |
+
+When free data blocks drop to the low water mark the pool raises an event on the device once, until the flag is cleared again on resume ([dm-thin.c:3636][thin3636]; set at [dm-thin.c:1501-1510][thin1501]). An event increments the device's event counter and wakes anything waiting on it ([dm.c:2443-2457][dm2443]). `alloc_data_block()` tries a commit before giving up on an empty pool ([dm-thin.c:1530-1548][thin1530]). A code comment says that a frequently seen `PM_OUT_OF_DATA_SPACE` means the low water mark should be adjusted ([dm-thin.c:2594-2600][thin2594]).
+
+!!! warning "Held bios can fail after a timeout"
+ By default, bios held in `PM_OUT_OF_DATA_SPACE` wait at most 60 seconds: `no_space_timeout` is a module parameter and a value of 0 arms no timer ([dm-thin.c:34][thin34], [dm-thin.c:4553][thin4553], [dm-thin.c:2609-2610][thin2609]). When it expires with the pool still out of data space, the pool sets `error_if_no_space` and fails the queued bios with `BLK_STS_NOSPC` ([dm-thin.c:2448-2457][thin2448]).
+
+## cache
+
+The `cache` target puts a fast device in front of a slow one. Its table line is ` `, a feature list and a policy with its arguments ([dm-cache-target.c:2025-2042][cache2025]). The kernel documentation says it "aims to improve performance of a block device (eg, a spindle) by dynamically migrating some of its data to a faster, smaller device (eg, an SSD)" ([cache.rst:11-13][cacherst11]) and that it "reuses the metadata library used in the thin-provisioning library" ([cache.rst:20-21][cacherst20]).
+
+### Three I/O modes
+
+In writethrough mode, a write hit on a block that is already dirty, for example one left by an earlier writeback mode, is written to the cache only ([dm-cache-target.c:1745-1750][cache1745]); only passthrough requires all blocks to be clean before it can be entered ([dm-cache-target.c:2835-2839][cache2835]). The table below summarises the mode comments at [dm-cache-target.c:254-274][cache254]; the arguments that select the mode are parsed at [dm-cache-target.c:2210-2223][cache2210], and writeback is the default ([dm-cache-target.c:2184][cache2184]).
+
+| Mode | Where a hit goes | Can the cache hold data newer than the origin? | What the source comment says |
+|---|---|---|---|
+| writeback | cache | ✓ | "Data is written to cached blocks only. These blocks are marked dirty. If you lose the cache device you will lose data." |
+| writethrough | cache; a write to a clean block goes to both devices ([dm-cache-target.c:1745-1750][cache1745]) | ✗ for a write to a clean block; a write to an already-dirty block goes to the cache only ([dm-cache-target.c:1745-1750][cache1745]) | "Data is written to both cache and origin. Blocks are never dirty." |
+| passthrough | origin; a write also invalidates the cache block, and after the metadata commit the write is remapped to the origin ([dm-cache-target.c:1737-1743][cache1737], [dm-cache-target.c:1522-1555][cache1522]) | ✗ | "Reads and writes always go to the origin. If a write goes to a cached oblock, then the cache block is invalidated." |
+
+!!! warning "Writeback loses data with the cache device"
+ In writeback mode the cache can hold the only up-to-date copy of a block. The source comment says so directly: "If you lose the cache device you will lose data" ([dm-cache-target.c:256-259][cache256]).
+
+### The map path
+
+`cache_map()` sends bios for the partial block at the end of the origin straight to the origin, because those blocks are not cached ([dm-cache-target.c:2676-2685][cache2676]). It defers discards and flush or FUA bios to a worker ([dm-cache-target.c:2687-2690][cache2687], [dm-cache-target.c:1006-1009][cache1006]). Of the bios the worker receives, `REQ_PREFLUSH` goes to `process_flush_bio()`, a discard to `process_discard_bio()` and anything else, including a FUA write without `REQ_PREFLUSH`, to `process_bio()` and so to `map_bio()` ([dm-cache-target.c:1865-1873][cache1865]). Every other bio goes to `map_bio()` directly, which takes a shared lock on the block and asks the policy about it ([dm-cache-target.c:1665-1697][cache1665]).
+
+```mermaid
+flowchart TD
+ A["bio for the cache device"] --> B{"past the last
whole origin block?"}
+ B -- yes --> O1["origin"]
+ B -- no --> C{"discard, flush
or FUA?"}
+ C -- yes --> W["worker"]
+ W -- "FUA without PREFLUSH" --> D
+ C -- no --> D{"policy lookup"}
+ D -- miss --> O2["origin"]
+ D -- "writeback mode, miss, whole-block
write or discarded block, and the
policy returns a promotion" --> MG["start a migration
with this bio"]
+ D -- hit --> E{"mode"}
+ E -- "writeback" --> CA["cache"]
+ E -- "writethrough" --> F{"write to a
clean block?"}
+ F -- yes --> BOTH["origin and cache"]
+ F -- no --> CA
+ E -- "passthrough" --> G{"write?"}
+ G -- yes --> INV["invalidate the cache block,
commit, then remap to the origin"]
+ G -- no --> O3["origin"]
+```
+
+- **Miss:** the bio is remapped to the origin ([dm-cache-target.c:1715-1718][cache1715]). The code also ends a bio whose per-bio request number is not zero, with a comment calling it "a duplicate writethrough io" for a demoted block ([dm-cache-target.c:1716-1725][cache1719]); at v7.3 writethrough duplicates a write with `bio_alloc_clone()` and `bio_chain()` ([dm-cache-target.c:830-845][cache830]), and the target asks for two copies of a flush, which take `process_flush_bio()` instead ([dm-cache-target.c:2435][cache2435], [dm-cache-target.c:1866-1867][cache1868]). In writeback mode, when the bio is for a discarded block or writes a whole block and the policy returns a promotion, a migration is started with the bio instead ([dm-cache-target.c:1690-1695][cache1690]).
+- **Hit:** as in the table above ([dm-cache-target.c:1737-1750][cache1737]).
+- **FUA:** a bio that reaches this point is issued after the metadata commit ([dm-cache-target.c:1757-1765][cache1757]). A FUA write that instead starts a migration with the bio, as in the miss case above, is written to the cache by `overwrite()` and ended by `mg_complete()` once the mapping is inserted, without that commit step ([dm-cache-target.c:1144-1163][cache1144], [dm-cache-target.c:1191-1198][cache1191], [dm-cache-target.c:1252-1263][cache1252]).
+
+### The policy decides what moves
+
+The core does not decide what to cache. A policy plug-in is asked about each bio that reaches the lookup (bios past the last whole origin block, discards and `REQ_PREFLUSH` bios take other paths, [dm-cache-target.c:2676-2690][cache2676]), and it can queue *background work* of three kinds: promote, demote and writeback ([dm-cache-policy.h:21-24][pol21]). In passthrough mode the target tells the policy that migrations are not allowed ([dm-cache-target.c:2508-2509][cache2508]), and the `smq` policy then queues no promotions ([dm-cache-policy-smq.c:1254-1255][smq1254]). A worker asks the policy for background work, telling it whether the device is idle, and starts each item as a migration ([dm-cache-target.c:1915-1940][cache1915]).
+
+```mermaid
+flowchart TD
+ A["map_bio: policy lookup"] -- "the policy queued background work" --> B["wake the migration worker"]
+ B --> C["check_migrations: ask the policy for work
promote, demote or writeback"]
+ C --> D["mg_start: lock the block against writes
reads continue"]
+ D --> E["copy the data
skipped for a discarded block, or when a demotion
or writeback finds the cache block clean"]
+ E --> F["upgrade the lock:
block reads and writes"]
+ F --> G{"operation"}
+ G -- promote --> H["insert the mapping"]
+ G -- demote --> I["remove the mapping
and commit"]
+ G -- writeback --> J["no mapping change"]
+ H --> K["complete: clear the dirty bit where the code does,
tell the policy, unlock the block, replay held bios"]
+ I --> K
+ J --> K
+ A -- "writeback mode, and the bio is for a discarded block
or writes a whole block: if the policy returns a promotion at once" --> D2["mg_start with the bio:
lock reads and writes"]
+ D2 --> E2["overwrite(): write the bio
into the cache block"]
+ E2 --> H
+```
+
+The anchors: the worker is woken from `map_bio()` when the policy queues work ([dm-cache-target.c:1705-1706][cache1705]), and also by the periodic waker ([dm-cache-target.c:1910][cache1910]); it asks the policy for work in `check_migrations()` ([dm-cache-target.c:1915-1940][cache1915]); `mg_lock_writes()` blocks writes and lets reads continue, and locks reads and writes when the migration carries the bio itself, the bottom branch ([dm-cache-target.c:1409-1417][cache1409], [dm-cache-target.c:1690-1694][cache1690]), which uses `overwrite()` in place of the copy and the lock upgrade ([dm-cache-target.c:1391-1394][cache1391]); `mg_full_copy()` skips the copy in the cases shown ([dm-cache-target.c:1354-1358][cache1354]); `mg_upgrade_lock()` blocks reads and writes ([dm-cache-target.c:1331-1335][cache1331]); `mg_update_metadata()` does the per-operation step, and a demotion commits ([dm-cache-target.c:1251-1302][cache1251], [dm-cache-target.c:1292-1297][cache1292]); `mg_complete()` clears the dirty bit on success for a promotion without a bio, a demotion and a writeback, sets it on success for a promotion that carries a bio, ends that bio, tells the policy and replays the bios that waited ([dm-cache-target.c:1186-1234][cache1186], [dm-cache-target.c:1191-1198][cache1191]).
+
+The tree registers four policy names: `smq`, `mq`, `cleaner` and `default` ([dm-cache-policy-smq.c:1885-1939][smq1885]). The first three are created by the same function, `__smq_create()`, with different flag arguments ([dm-cache-policy-smq.c:1858-1880][smq1858]); `default` points at the `smq` type through `.real` ([dm-cache-policy-smq.c:1909-1914][smq1909]).
+
+One shortcut avoids the copy. In writeback mode, a bio to a discarded block or one that writes a whole block is looked up with `policy_lookup_with_work()` ([dm-cache-target.c:1072-1076][cache1072], [dm-cache-target.c:1679-1695][cache1679]). The policy header explains the method: the core "needs the migration immediately though so it knows to do something different with the bio" ([dm-cache-policy.h:60-64][pol60]). The migration then uses `overwrite()` in place of a full copy, falling back to the full copy if the bio is no longer eligible ([dm-cache-target.c:1368-1394][cache1368]).
+
+The commit that added the target ([`c6b4fcbad044`][cc6b4fcbad044], "dm: add cache target", Linux 3.9, 2013-03-01) states the design choice: "A plug-in architecture was chosen so that the decisions about which data to migrate and when are delegated to interchangeable tunable policy modules."
+
+Cache uses version 2 of the bio prison, the structure behind the cells described above ([dm-cache-target.c:9][cache9], [dm-cache-target.c:1082][cache1082]); thin provisioning uses version 1 ([dm-thin.c:9][thin9]). Version 2 came in Linux 4.12 ([`742c8fdc31e8`][c742c8fdc31e8], "dm bio prison v2: new interface for the bio prison", 2016-10-21).
+
+## Where it came from
+
+```mermaid
+timeline
+ 2002 : dm-ioctl submitted for review
+ 2006 : request-based dm RFC
+ 2009 : request-based dm merged (2.6.31)
+ 2011 : thin provisioning and persistent-data library (3.2)
+ 2013 : cache target (3.9)
+ 2015 : request-based dm on blk-mq (4.1)
+ 2022 : dm_submit_bio_remap (5.18)
+```
+
+| When | What | Evidence |
+|---|---|---|
+| 2002-10-15 | The ioctl interface to device-mapper is posted: "Provide a traditional ioctl based interface to control device-mapper from userland." | [LWN: Device-mapper submission 6/7][lwn12734] |
+| 2.6.12 (tag `v2.6.12-rc2`, 2005-04-16, the first commit in the git history) | `dm-linear.c` and `dm-ioctl.c` already exist; `dm-linear.c` carries "Copyright (C) 2001-2003 Sistina Software (UK) Limited." ([dm-linear.c:3][lin3]) | [`1da177e4c3f4`][c1da177e4c3f4] |
+| 2006-12-19 | RFC for request-based DM: "Hook for I/O mapping is at request_fn after merging and sorting by I/O scheduler, instead of make_request_fn." | [LWN: rqbased-dm][lwn215058] |
+| 2008-03-19 | The series is posted as an RFC: "Currently, device-mapper (dm) is implemented as a stacking block device at bio level." | [LWN: request stacking and request-based dm-multipath][lwn274292] |
+| 2008-09-12, 2008-10-03 | Later postings of the series: 13 patches, then 8 patches | [LWN 13 patches][lwn298882], [LWN 8 patches][lwn301919] |
+| 2.6.31 (2009-06-22) | Request-based DM is prepared and enabled | [`cec47e3d4a86`][ccec47e3d4a86], [`e6ee8c0b7675`][ce6ee8c0b7675] |
+| 3.2 (2011-10-31) | Persistent-data library, then thin provisioning | [`3241b1d3e0aa`][c3241b1d3e0aa], [`991d9fa02da0`][c991d9fa02da0] |
+| 3.9 (2013-03-01) | `cache` target; the documentation was posted on LWN on 2013-03-04 | [`c6b4fcbad044`][cc6b4fcbad044], [LWN: cache.txt][lwn540996] |
+| 4.0 (2014-12-17) | Requests are allocated in the target when stacking on blk-mq devices; a later commit, `bfebd1cdb497` in 4.1 (next row), calls this "the first step toward fully utilizing blk-mq in request-based DM" | [`e5863d9ad754`][ce5863d9ad754] |
+| 4.1 (2015-03-08) | The mapped device's own queue can become blk-mq, for tables stacked on blk-mq devices: "enables stacking a blk-mq request_queue ontop of the underlying blk-mq device(s)" | [`bfebd1cdb497`][cbfebd1cdb497] |
+| 4.12 (2016-10-21) | Bio prison v2 | [`742c8fdc31e8`][c742c8fdc31e8] |
+| 5.18 (2022-02-17) | `dm_submit_bio_remap()` lets a target that submits clones itself have them accounted when it submits them, if it sets `accounts_remapped_io` | [`0fbb4d93b38b`][c0fbb4d93b38b] |
+| 5.19 (2022-04-12) | Reworked bio splitting and I/O accounting | [`7dd76d1feec7`][c7dd76d1feec7] |
+
+The commits for these four changes carry no `Link:` trailer, so each posting below was found in the dm-devel archive by subject and checked against the commit message. Where the commit message was revised after posting, the table says so. Dates are the archive's message dates.
+
+| Change | Posting on dm-devel | Relation to the commit |
+|---|---|---|
+| Thin provisioning and persistent data (3.2) | 2011-07-08, "[PATCH 0/3] initial release of dm thin provisioning target" ([cover][lore-thin0]), with the library as [2/3][lore-thin2] and the target as [3/3][lore-thin3] | Posted by Mike Snitzer; the body names Joe Thornber as the author; the commit message is a reworded form of the 3/3 text |
+| Cache target (3.9) | 2012-12-13, "[PATCH 8/8] [dm-cache] cache target" ([8/8][lore-cache8]) | The first posting of the code; its message has no description, the commit message adds one |
+| `dm_submit_bio_remap()` (5.18) | 2022-02-10, "[PATCH 10/14] dm: add dm_submit_bio_remap interface" ([v1][lore-remap1]); 2022-02-11, "[PATCH v2 11/14]" ([v2][lore-remap2]) | The commit message extends the v2 text: the `xchg()` paragraph gains the explanation of the `__send_duplicate_bios()` race, a `bio_endio` paragraph is added, and the opening sentence now says "Where possible" |
+| Bio splitting and I/O accounting (5.19) | 2022-04-17, "[dm-5.19 PATCH 16/21] dm: improve bio splitting and associated IO accounting" ([16/21][lore-split16]) | The body names Ming Lei as the author; the commit message matches the posting |
+
+## Further reading
+
+- [Block Layer Overview](block-overview.md) and [bio and request structures](bio-request.md): the structures a mapped device receives and clones.
+- [blk-mq](blk-mq.md): the queues that request-based DM sits on.
+- [dm-verity](dm-verity.md) and [dm-crypt](../security/dm-crypt.md): two other targets.
+- Kernel documentation: [thin-provisioning.rst][thinrst], [cache.rst][cacherst] and the rest of [Documentation/admin-guide/device-mapper/][dmdocs].
+
+[blk394]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/blk_types.h?h=v7.3#n394
+[blk395]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/blk_types.h?h=v7.3#n395
+[blk396]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/blk_types.h?h=v7.3#n396
+[blk398]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/blk_types.h?h=v7.3#n398
+[blk469]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/blk_types.h?h=v7.3#n469
+[cache1006]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1006
+[cache1072]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1072
+[cache1082]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1082
+[cache1186]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1186
+[cache1191]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1191
+[cache1251]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1251
+[cache1292]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1292
+[cache1331]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1331
+[cache1354]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1354
+[cache1368]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1368
+[cache1391]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1391
+[cache1409]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1409
+[cache1665]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1665
+[cache1674]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1674
+[cache1679]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1679
+[cache1690]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1690
+[cache1705]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1705
+[cache1719]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1716
+[cache1715]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1715
+[cache1737]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1737
+[cache1745]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1745
+[cache1757]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1757
+[cache1768]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1768
+[cache1910]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1910
+[cache1915]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1915
+[cache2025]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2025
+[cache2184]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2184
+[cache2210]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2210
+[cache254]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n254
+[cache256]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n256
+[cache2676]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2676
+[cache2687]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2687
+[cache2835]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2835
+[cache3556]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n3556
+[cache9]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n9
+[cacherst]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/cache.rst?h=v7.3
+[cacherst11]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/cache.rst?h=v7.3#n11
+[cacherst20]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/cache.rst?h=v7.3#n20
+[core189]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-core.h?h=v7.3#n189
+[core35]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-core.h?h=v7.3#n35
+[core60]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-core.h?h=v7.3#n60
+[core78]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-core.h?h=v7.3#n78
+[core97]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-core.h?h=v7.3#n97
+[dm1047]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1047
+[dm1114]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1114
+[dm1134]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1134
+[dm1147]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1147
+[dm1161]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1161
+[dm1386]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1386
+[dm1414]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1414
+[dm1430]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1430
+[dm1435]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1435
+[dm1437]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1437
+[dm1457]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1457
+[dm1736]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1736
+[dm1749]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1749
+[dm1767]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1767
+[dm2013]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2013
+[dm2046]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2046
+[dm2052]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2052
+[dm2080]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2080
+[dm2081]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2081
+[dm2089]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2089
+[dm2099]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2099
+[dm2443]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2443
+[dm2529]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2529
+[dm2610]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2610
+[dm2855]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2855
+[dm1438]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1438
+[dm2889]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2889
+[dm2900]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2900
+[dm2942]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2942
+[dm2987]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2987
+[dm2995]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2995
+[dm3014]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3014
+[dm3022]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3022
+[dm3116]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3116
+[dm3123]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3123
+[dm3125]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3125
+[dm3128]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3128
+[dm3804]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3804
+[dm3816]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n3816
+[dm620]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n620
+[dm626]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n626
+[dm645]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n645
+[dm997]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n997
+[dmdocs]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/?h=v7.3
+[dmh173]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n173
+[dmh185]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n185
+[dmh198]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n198
+[dmh215]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n215
+[dmh234]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n234
+[dmh254]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n254
+[dmh29]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n29
+[dmh312]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n312
+[dmh331]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n331
+[dmh358]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n358
+[dmh63]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n63
+[dmh710]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/device-mapper.h?h=v7.3#n710
+[dmt1129]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1129
+[dmt1505]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1505
+[dmt1565]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1565
+[dmt1570]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1570
+[dmt1573]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1573
+[dmt1577]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1577
+[dmt195]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n195
+[dmt2155]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n2155
+[dmt2179]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n2179
+[dmt30]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n30
+[dmt388]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n388
+[dmt670]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n670
+[dmt688]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n688
+[dmt703]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n703
+[dmt711]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n711
+[dmt717]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n717
+[dmt738]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n738
+[dmt743]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n743
+[dmt749]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n749
+[dmt754]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n754
+[dmt925]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n925
+[dmt965]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n965
+[dmt970]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n970
+[ioc1274]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1274
+[ioc1280]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1280
+[ioc1284]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1284
+[ioc1311]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1311
+[ioc1331]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1331
+[ioc1363]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1363
+[ioc1617]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1617
+[ioc1639]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1639
+[ioc1649]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1649
+[ioc1666]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1666
+[ioc1687]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1687
+[ioc1702]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1702
+[ioc1985]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1985
+[ioc2034]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n2034
+[ioc2299]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n2299
+[ioc977]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n977
+[ioh293]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/dm-ioctl.h?h=v7.3#n293
+[lin202]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-linear.c?h=v7.3#n202
+[lin28]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-linear.c?h=v7.3#n28
+[lin3]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-linear.c?h=v7.3#n3
+[lin61]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-linear.c?h=v7.3#n61
+[lin82]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-linear.c?h=v7.3#n82
+[lin96]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-linear.c?h=v7.3#n96
+[linearrst28]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/linear.rst?h=v7.3#n28
+[lwn12734]: https://lwn.net/Articles/12734/
+[lwn215058]: https://lwn.net/Articles/215058/
+[lwn274292]: https://lwn.net/Articles/274292/
+[lwn298882]: https://lwn.net/Articles/298882/
+[lwn301919]: https://lwn.net/Articles/301919/
+[lwn540996]: https://lwn.net/Articles/540996/
+[mdh41]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.h?h=v7.3#n41
+[mpath1159]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-mpath.c?h=v7.3#n1159
+[mpath2300]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-mpath.c?h=v7.3#n2300
+[mpath240]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-mpath.c?h=v7.3#n240
+[pol21]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-policy.h?h=v7.3#n21
+[pol60]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-policy.h?h=v7.3#n60
+[rq412]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-rq.c?h=v7.3#n412
+[smq1858]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-policy-smq.c?h=v7.3#n1858
+[smq1885]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-policy-smq.c?h=v7.3#n1885
+[smq1909]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-policy-smq.c?h=v7.3#n1909
+[tgt18]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-target.c?h=v7.3#n18
+[tgt46]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-target.c?h=v7.3#n46
+[tgt51]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-target.c?h=v7.3#n51
+[thin1004]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1004
+[thin1009]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1009
+[thin1335]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1335
+[thin1338]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1338
+[thin1396]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1396
+[thin1415]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1415
+[thin1449]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1449
+[thin1473]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1473
+[thin1487]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1487
+[thin1490]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1490
+[thin1494]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1494
+[thin1501]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1501
+[thin1530]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1530
+[thin1545]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1545
+[thin1553]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1553
+[thin1600]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1600
+[thin1603]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1603
+[thin1614]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1614
+[thin1799]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1799
+[thin1887]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1887
+[thin3636]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3636
+[thin4216]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4216
+[thin1923]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1923
+[thin1930]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1930
+[thin1933]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1933
+[thin1977]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1977
+[thin203]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n203
+[thin2032]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2032
+[thin207]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n207
+[thin2109]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2109
+[thin2386]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2386
+[thin2402]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2402
+[thin2448]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2448
+[thin2548]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2548
+[thin2560]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2560
+[thin2580]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2580
+[thin2594]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2594
+[thin2602]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2602
+[thin2609]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2609
+[thin2643]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2643
+[thin2654]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2654
+[thin2719]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2719
+[thin2731]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2731
+[thin2742]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2742
+[thin2751]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2751
+[thin2752]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2752
+[thin2762]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2762
+[thin2764]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2764
+[thin2781]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2781
+[thin2794]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2794
+[thin2861]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2861
+[thin2901]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2901
+[thin3175]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3175
+[thin3271]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3271
+[thin33]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n33
+[thin3342]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3342
+[thin34]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n34
+[thin3450]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3450
+[thin3537]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3537
+[thin3855]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3855
+[thin41]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n41
+[thin4109]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4109
+[thin4111]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4111
+[thin4172]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4172
+[thin4326]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4326
+[thin4493]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4493
+[thin4495]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4495
+[thin4553]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n4553
+[thin735]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n735
+[thin756]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n756
+[thin9]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n9
+[thin964]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n964
+[thinrst]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/thin-provisioning.rst?h=v7.3
+[thinrst104]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/thin-provisioning.rst?h=v7.3#n104
+[thinrst165]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/thin-provisioning.rst?h=v7.3#n165
+[thinrst186]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/thin-provisioning.rst?h=v7.3#n186
+[thinrst192]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/device-mapper/thin-provisioning.rst?h=v7.3#n192
+[tm1174]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n1174
+[tm1205]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n1205
+[tm1218]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n1218
+[tm1497]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n1497
+[tm1518]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n1518
+[tm1648]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n1648
+[tm20]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n20
+[tm68]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n68
+[c0fbb4d93b38b]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0fbb4d93b38bce1f8235aacfa37e90ad8f011473
+[c1da177e4c3f4]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
+[c3241b1d3e0aa]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3241b1d3e0aaafbfcd320f4d71ade629728cc4f4
+[c742c8fdc31e8]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=742c8fdc31e820503f9267070311d894978d1349
+[c7dd76d1feec7]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7dd76d1feec70a23e1de2b55c0c2a9c592fa8423
+[c991d9fa02da0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=991d9fa02da0dd1f843dc011376965e0c8c6c9b5
+[cbfebd1cdb497]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bfebd1cdb497a57757c83f5fbf1a29931591e2a4
+[cc6b4fcbad044]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c6b4fcbad044e6fffcc75bba160e720eb8d67d17
+[ccec47e3d4a86]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cec47e3d4a861e1d942b3a580d0bbef2700d2bb2
+[ce5863d9ad754]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5863d9ad754926e7d3f38b43ac8bd48ef73b097
+[ce6ee8c0b7675]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e6ee8c0b767540f59e20da3ced282601db8aa502
+[v73]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/?h=v7.3
+[lore-thin0]: https://lore.kernel.org/dm-devel/1310163592-29683-1-git-send-email-snitzer@redhat.com/
+[lore-thin2]: https://lore.kernel.org/dm-devel/1310163592-29683-3-git-send-email-snitzer@redhat.com/
+[lore-thin3]: https://lore.kernel.org/dm-devel/1310163592-29683-4-git-send-email-snitzer@redhat.com/
+[lore-cache8]: https://lore.kernel.org/dm-devel/1355429956-22785-9-git-send-email-ejt@redhat.com/
+[lore-remap1]: https://lore.kernel.org/dm-devel/20220210223832.99412-11-snitzer@redhat.com/
+[lore-remap2]: https://lore.kernel.org/dm-devel/20220211214057.40612-12-snitzer@redhat.com/
+[lore-split16]: https://lore.kernel.org/dm-devel/20220418022733.56168-17-snitzer@kernel.org/
+[dm1740]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1740
+[dm590]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n590
+[dm2024]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n2024
+[ioc1224]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1224
+[dmt677]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n677
+[dmt1481]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n1481
+[thin2583]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2583
+[thin2613]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2613
+[thin1909]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1909
+[thin1356]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n1357
+[cache2508]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2508
+[smq1254]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-policy-smq.c?h=v7.3#n1254
+[dm1524]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1524
+[dmt763]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n763
+[dm1571]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1571
+[dm1677]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1677
+[thin3438]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3438
+[thin987]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n987
+[thin2399]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n2399
+[cache1865]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1865
+[cache247]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n248
+[dm986]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n986
+[dm903]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n903
+[thin3573]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin.c?h=v7.3#n3573
+[cache1522]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1522
+[tm22]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-thin-metadata.c?h=v7.3#n22
+[ioc1650]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-ioctl.c?h=v7.3#n1650
+[dm1097]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1097
+[dm1589]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n1589
+[cache830]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n830
+[cache2435]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n2435
+[cache1868]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1866
+[dmt486]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-table.c?h=v7.3#n486
+[dm576]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n577
+[cache1144]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1144
+[cache1252]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-cache-target.c?h=v7.3#n1252
+[dm669]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n669
+[dm887]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm.c?h=v7.3#n887
diff --git a/mkdocs.yml b/mkdocs.yml
index 657f420..a93e8d6 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -397,6 +397,7 @@ nav:
- I/O Schedulers: block/io-schedulers.md
- Block Cgroup (I/O Control): block/blk-cgroup.md
- NVMe Driver: block/nvme.md
+ - Device Mapper (Core and Targets): block/device-mapper.md
- dm-verity (Integrity): block/dm-verity.md
- War Stories: block/war-stories.md
- Observability: block/block-observability.md