summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2022-08-03 22:43:22 -0400
committerMike Snitzer <snitzer@kernel.org>2022-08-04 14:02:20 -0400
commit0a36463f4ca287e4d4ac15580c0aae5b23619212 (patch)
treea0f2cc6bff2dcb7aeeba1f005a79a4b1b7f19edd /drivers/md
parentba2cce82ba1ba74cd83bb3fd0e47849af4f2a605 (diff)
downloadlinux-0a36463f4ca287e4d4ac15580c0aae5b23619212.tar.bz2
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 <snitzer@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-verity-target.c9
1 files changed, 8 insertions, 1 deletions
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) {
/*