From 0a36463f4ca287e4d4ac15580c0aae5b23619212 Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Wed, 3 Aug 2022 22:43:22 -0400 Subject: 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: Mike Snitzer --- drivers/md/dm-verity-target.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index d287d01b7684..5a4ee3292853 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -498,7 +498,9 @@ static int verity_verify_io(struct dm_verity_io *io) { bool is_zero; struct dm_verity *v = io->v; +#if defined(CONFIG_DM_VERITY_FEC) struct bvec_iter start; +#endif /* * Copy the iterator in case we need to restart verification in a * work-queue. @@ -542,7 +544,10 @@ static int verity_verify_io(struct dm_verity_io *io) if (unlikely(r < 0)) 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); if (unlikely(r < 0)) return r; @@ -564,9 +569,11 @@ static int verity_verify_io(struct dm_verity_io *io) * tasklet since it may sleep, so fallback to work-queue. */ return -EAGAIN; +#if defined(CONFIG_DM_VERITY_FEC) } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA, cur_block, NULL, &start) == 0) { continue; +#endif } else { if (bio->bi_status) { /* -- cgit v1.2.3-59-g8ed1b