UPSTREAM: dm verity: add support for forward error correction
authorSami Tolvanen <samitolvanen@google.com>
Thu, 3 Dec 2015 14:26:30 +0000 (14:26 +0000)
committerAmit Pundir <amit.pundir@linaro.org>
Thu, 7 Apr 2016 11:20:06 +0000 (16:50 +0530)
commitd5fe9722ab2ef9ac6232164204d3b1d04d3ab75c
treeca5395a7c47658649d703f714c189dbb52c863db
parentc81331d2f4248c76f8d68a0efedb691fe1343596
UPSTREAM: dm verity: add support for forward error correction

Add support for correcting corrupted blocks using Reed-Solomon.

This code uses RS(255, N) interleaved across data and hash
blocks. Each error-correcting block covers N bytes evenly
distributed across the combined total data, so that each byte is a
maximum distance away from the others. This makes it possible to
recover from several consecutive corrupted blocks with relatively
small space overhead.

In addition, using verity hashes to locate erasures nearly doubles
the effectiveness of error correction. Being able to detect
corrupted blocks also improves performance, because only corrupted
blocks need to corrected.

For a 2 GiB partition, RS(255, 253) (two parity bytes for each
253-byte block) can correct up to 16 MiB of consecutive corrupted
blocks if erasures can be located, and 8 MiB if they cannot, with
16 MiB space overhead.

Change-Id: Ife4f8889f7fbf0974bf3ed4be6d3322ae9b4cb0e
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit a739ff3f543afbb4a041c16cd0182c8e8d366e70)
Documentation/device-mapper/verity.txt
drivers/md/Kconfig
drivers/md/Makefile
drivers/md/dm-verity-fec.c [new file with mode: 0644]
drivers/md/dm-verity-fec.h [new file with mode: 0644]
drivers/md/dm-verity-target.c
drivers/md/dm-verity.h