Skip to content

Commit 0a36463

Browse files
author
Mike Snitzer
committed
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 <[email protected]>
1 parent ba2cce8 commit 0a36463

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/md/dm-verity-target.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ static int verity_verify_io(struct dm_verity_io *io)
498498
{
499499
bool is_zero;
500500
struct dm_verity *v = io->v;
501+
#if defined(CONFIG_DM_VERITY_FEC)
501502
struct bvec_iter start;
503+
#endif
502504
/*
503505
* Copy the iterator in case we need to restart verification in a
504506
* work-queue.
@@ -542,7 +544,10 @@ static int verity_verify_io(struct dm_verity_io *io)
542544
if (unlikely(r < 0))
543545
return r;
544546

545-
start = iter_copy;
547+
#if defined(CONFIG_DM_VERITY_FEC)
548+
if (verity_fec_is_enabled(v))
549+
start = iter_copy;
550+
#endif
546551
r = verity_for_io_block(v, io, &iter_copy, &wait);
547552
if (unlikely(r < 0))
548553
return r;
@@ -564,9 +569,11 @@ static int verity_verify_io(struct dm_verity_io *io)
564569
* tasklet since it may sleep, so fallback to work-queue.
565570
*/
566571
return -EAGAIN;
572+
#if defined(CONFIG_DM_VERITY_FEC)
567573
} else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA,
568574
cur_block, NULL, &start) == 0) {
569575
continue;
576+
#endif
570577
} else {
571578
if (bio->bi_status) {
572579
/*

0 commit comments

Comments
 (0)