Skip to content

block: add a device-mapper core and targets page - #912

Open
laveeshb wants to merge 20 commits into
mainfrom
block-device-mapper-896
Open

laveeshb wants to merge 20 commits into
mainfrom
block-device-mapper-896

Conversation

@laveeshb

@laveeshb laveeshb commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Adds block/device-mapper.md, linked from the block README and the nav.

Device mapper builds a virtual block device from a table of ranges, each handled by a target. docs/block/ covered dm-verity and security/ covers dm-crypt, but nothing explained the core or the common targets. Every behaviour claim links to the function or line at Linux v7.3, every history claim links to its commit (the full hash is in the link; release and author date are in the text) or to the LWN posting, and quotes are verbatim. The page covers:

  • what a table and a target are, with a diagram, and the control interface (/dev/mapper/control);
  • the lifecycle: load a table as inactive, then suspend, swap and resume, including what happens to bios while suspended;
  • the sector index and the rules a table enforces (gaps, singleton, immutable and wildcard targets);
  • the bio path: split, clone, map, the DM_MAPIO_* return values, completion, and how flushes and discards are handled;
  • bio-based versus request-based devices, with the multipath example;
  • the target interface and where the core calls each callback;
  • linear, the smallest target, with its map function quoted;
  • thin provisioning: the pool and thin targets, the metadata layout, the path of a bio, when metadata is committed, snapshots, and the pool modes with a state diagram and per-transition sources;
  • the cache target: its three I/O modes, the map path, and how policies drive migrations;
  • history, from the 2002 ioctl submission and the 2006-2008 request-based DM series to dm_submit_bio_remap(), with every commit linked to git.kernel.org. The thin-provisioning, cache, dm_submit_bio_remap() and bio-splitting commits carry no Link: trailer, so each posting is linked from the history section and was compared with its commit message.

mkdocs build --strict passes.

Closes #896
Part of #882

Explain how a mapped device is built from a table of ranges, how a table is loaded, suspended, swapped and resumed, and how a bio is cloned, mapped and completed. Cover the linear, thin-provisioning and cache targets, and the history of request-based DM, thin provisioning and the cache target.
Add the transitions out of PM_OUT_OF_METADATA_SPACE and from a table reload, give discards and unshared mapped blocks their own branches in the thin diagram, and scope the thin copy, writethrough and cache-miss statements to what the code does. Correct a few citation ranges.
…ice-mapper page

Add a map of where a mapped device sits, an object diagram, worked examples for the sector index and for a bio that crosses a target boundary, a snapshot-sharing diagram, a commit-batching sequence, a cache migration flow, a target feature matrix, a side-by-side table of linear, thin and cache, and examples quoted from the kernel documentation.
…write path

Link every commit to git.kernel.org, show the cache migration that carries the bio, and correct the object map, snapshot, map-return and table-line statements. Note which list postings are not linked.
Point every source link at the v7.3 release instead of v7.4-rc5. The line numbers are remapped from the diff between the two tags, and the description of the table's device list now matches v7.3, where struct dm_dev_internal holds a reference count and a dm_dev pointer.
Link "Linux v7.3" in the source note to the v7.3 tree on git.kernel.org.
Name the conditions under which a cache miss starts a migration, which
thin pool modes use the read-only handlers, and where the swap keeps the
existing queue limits. Cite the zero-fill path for reads of unmapped thin
blocks and describe the 13- and 8-patch LWN postings by their counts.
State that the bio-path steps are for normal I/O, that the thin bio diagram shows the PM_WRITE handlers, that empty flush bios are not provisioned, and which cache writes go to the cache only. Cover the straddling-origin and passthrough cases, the needs_check demotion and the CONFIG_BLK_INLINE_ENCRYPTION condition.
Abnormal I/O is still cloned and mapped, by __process_abnormal_io(); fix the reference-count and single-device-test line anchors; scope the thin diagram and the FUA-commit sentence; and separate the straddling and past-the-end origin cases.
@laveeshb laveeshb added the agent:server02 Claimed by the server02 agent label Nov 30, 2026
…ge cases in the device-mapper page

An empty flush on a table of flush_bypasses_map targets goes straight to the underlying devices; a FUA write without PREFLUSH reaches the cache policy through the worker; whole-block FUA overwrites are completed from a second list after the commit; the read-only pool modes and PM_FAIL are scoped to thin devices and to writes with data.
…in statements

Name the two completion exceptions with their sources, include write-zeroes in the copy counts, say that stripe also sets flush_bypasses_map, restrict the second flush list to writes issued ahead of the mapping, and describe the truncated origin read.
…statements

Add the polled BLK_STS_AGAIN requeue case, say that the part of an origin-straddling read inside the origin is the part read, and include the break-sharing copy in the writes that reach the second flush list.
Cite what the metadata header says about the superblock and space maps, include FUA writes among the bios the thin target defers, anchor the end_io and wildcard rows to the code that shows them, fix two off-by-one line anchors, escape the underscores in a quoted comment, and remove duplicate and mismatched link labels.
… device-mapper page

Describe the unreachable-looking writethrough duplicate branch from what the source shows, say that REQ_PREFLUSH bios (not all flush-flagged bios) skip the policy lookup, scope the thin diagram edges and the FUA sequence to writes with data and to the submit path, and note the sector-zero start rule and the clone allocation.
… discard case

A FUA write that starts a migration with the bio is ended without the commit step; the promotion edge in the migration diagram is conditional; discards in the read-only pool modes are completed, not remapped; and two line anchors and a stray comma are corrected.
Align two line-range labels with their anchors, describe the deferred-bio list as also holding re-queued I/O, cite the commit behind the thin overview sentence, and make the thin bio-path diagram cover empty flushes and the zeroing condition.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:server02 Claimed by the server02 agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

block: add a device-mapper core and targets page

1 participant