diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2015-12-03 15:26:31 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-12-10 16:39:03 +0100 |
commit | 0cc37c2df4fa0aa702f9662edce4b7ce12c86b7a (patch) | |
tree | ce34d33da52e65c3907034f294af01f7dd96ad0b /drivers/md/dm-verity-fec.c | |
parent | dm verity: add support for forward error correction (diff) | |
download | linux-0cc37c2df4fa0aa702f9662edce4b7ce12c86b7a.tar.xz linux-0cc37c2df4fa0aa702f9662edce4b7ce12c86b7a.zip |
dm verity: add ignore_zero_blocks feature
If ignore_zero_blocks is enabled dm-verity will return zeroes for blocks
matching a zero hash without validating the content.
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-verity-fec.c')
-rw-r--r-- | drivers/md/dm-verity-fec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c index 88143d36a1d2..1cc10c4de701 100644 --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c @@ -205,6 +205,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, u64 rsb, u64 target, unsigned block_offset, int *neras) { + bool is_zero; int i, j, target_index = -1; struct dm_buffer *buf; struct dm_bufio_client *bufio; @@ -264,7 +265,12 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, /* locate erasures if the block is on the data device */ if (bufio == v->fec->data_bufio && - verity_hash_for_block(v, io, block, want_digest) == 0) { + verity_hash_for_block(v, io, block, want_digest, + &is_zero) == 0) { + /* skip known zero blocks entirely */ + if (is_zero) + continue; + /* * skip if we have already found the theoretical * maximum number (i.e. fec->roots) of erasures |