Commit 0a36463f authored by Mike Snitzer's avatar Mike Snitzer

dm verity: optimize verity_verify_io if FEC not configured

Only declare and copy bvec_iter if CONFIG_DM_VERITY_FEC is defined and
FEC enabled for the verity device.
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent ba2cce82
...@@ -498,7 +498,9 @@ static int verity_verify_io(struct dm_verity_io *io) ...@@ -498,7 +498,9 @@ static int verity_verify_io(struct dm_verity_io *io)
{ {
bool is_zero; bool is_zero;
struct dm_verity *v = io->v; struct dm_verity *v = io->v;
#if defined(CONFIG_DM_VERITY_FEC)
struct bvec_iter start; struct bvec_iter start;
#endif
/* /*
* Copy the iterator in case we need to restart verification in a * Copy the iterator in case we need to restart verification in a
* work-queue. * work-queue.
...@@ -542,7 +544,10 @@ static int verity_verify_io(struct dm_verity_io *io) ...@@ -542,7 +544,10 @@ static int verity_verify_io(struct dm_verity_io *io)
if (unlikely(r < 0)) if (unlikely(r < 0))
return r; return r;
start = iter_copy; #if defined(CONFIG_DM_VERITY_FEC)
if (verity_fec_is_enabled(v))
start = iter_copy;
#endif
r = verity_for_io_block(v, io, &iter_copy, &wait); r = verity_for_io_block(v, io, &iter_copy, &wait);
if (unlikely(r < 0)) if (unlikely(r < 0))
return r; return r;
...@@ -564,9 +569,11 @@ static int verity_verify_io(struct dm_verity_io *io) ...@@ -564,9 +569,11 @@ static int verity_verify_io(struct dm_verity_io *io)
* tasklet since it may sleep, so fallback to work-queue. * tasklet since it may sleep, so fallback to work-queue.
*/ */
return -EAGAIN; return -EAGAIN;
#if defined(CONFIG_DM_VERITY_FEC)
} else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA, } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA,
cur_block, NULL, &start) == 0) { cur_block, NULL, &start) == 0) {
continue; continue;
#endif
} else { } else {
if (bio->bi_status) { if (bio->bi_status) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment