dm verity fec: Expose corrected block count via status
authorShubhankar Mishra <shubhankarm@google.com>
Wed, 5 Nov 2025 14:06:44 +0000 (14:06 +0000)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 18 Nov 2025 17:24:26 +0000 (18:24 +0100)
commitae97648e14f7907f4b0e0b295eb2fdcf43806f9d
tree866eb9b1ba223f979cb353d7d7ddc2ce67f93844
parentc82faa893418f584da8f38f9cbdda4533f49fd55
dm verity fec: Expose corrected block count via status

Enhance visibility into dm-verity Forward Error Correction (FEC)
activity. While FEC can correct on-disk corruptions, the number of
successful correction events is not readily exposed through a standard
interface.

This change integrates FEC statistics into the verity target's
.status handler for STATUSTYPE_INFO. The info output now
includes count of corrected block by FEC.

The counter is a per-device instance atomic64_t, maintained within
the struct dm_verity_fec, tracking blocks successfully repaired by FEC
on this specific device instance since it was created.

This approach aligns with the standard Device Mapper mechanism for
targets to report runtime information, as used by other targets like
dm-integrity.

This patch also updates Documentation/admin-guide/device-mapper/verity.rst
to reflect the new status information.

Tested:
  Induced single-bit errors on a block device protected by dm-verity
  with FEC on android phone. Confirmed 'dmctl status <device>' on Android
  reports an incrementing 'fec_corrected_blocks' count after the
  corrupted blocks were accessed.

Signed-off-by: Shubhankar Mishra <shubhankarm@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Documentation/admin-guide/device-mapper/verity.rst
drivers/md/dm-verity-fec.c
drivers/md/dm-verity-fec.h
drivers/md/dm-verity-target.c