This series adds support for formatting a VDO volume directly from the kernel module, eliminating the need for the userspace vdoformat tool.
When a VDO target is loaded and the geometry block (block 0) is entirely zeroed, the device is treated as unformatted. The module then computes and writes the geometry block, super block, and clears the regions used by the UDS index, block map, and recovery journal. The series is structured as follows: Patches 1-2 add initialization helpers for the geometry block and super block, computing the on-disk layout for each. Patch 3 extends the dm table line with three new optional parameters (indexMemory, indexSparse, slabSize) needed to configure formatting, and bumps the target version to 9.2.0. Patch 4 adds upfront validation for the logical size parameter. Patches 5-6 introduce the geometry block encoding function and a vdo_geometry_block structure that mirrors the existing super block infrastructure. Patch 7 adds a synchronous metadata I/O helper for use during early initialization before work queues are available. Patch 8 adds the core formatting logic: if the geometry block is zeroed, vdo_format() is called to initialize the volume geometry and super block. Patch 9 adds the disk write phases to the pre-load state machine, saving the super block, geometry block, and clearing the index/block map/recovery journal regions during pre-resume. Bruce Johnston (9): dm vdo: add geometry block initialization to encodings.c dm vdo: add super block initialization to encodings.c dm vdo: add formatting parameters to table line dm vdo: add upfront validation for logical size dm vdo: add geometry block encoding dm vdo: add geometry block structure dm vdo: add synchronous metadata I/O submission helper dm vdo: add formatting logic and initialization dm vdo: save the formatted metadata to disk drivers/md/dm-vdo/constants.h | 13 +- drivers/md/dm-vdo/dm-vdo-target.c | 139 ++++++++++- drivers/md/dm-vdo/encodings.c | 219 +++++++++++++++- drivers/md/dm-vdo/encodings.h | 17 ++ drivers/md/dm-vdo/indexer/index-layout.c | 26 ++ drivers/md/dm-vdo/indexer/indexer.h | 4 + drivers/md/dm-vdo/io-submitter.c | 27 ++ drivers/md/dm-vdo/io-submitter.h | 4 + drivers/md/dm-vdo/status-codes.c | 2 + drivers/md/dm-vdo/types.h | 3 + drivers/md/dm-vdo/vdo.c | 305 ++++++++++++++++------- drivers/md/dm-vdo/vdo.h | 19 ++ 12 files changed, 677 insertions(+), 101 deletions(-) -- 2.52.0
