dm verity: optimize verity_verify_io if FEC not configured
authorMike Snitzer <snitzer@kernel.org>
Thu, 4 Aug 2022 02:43:22 +0000 (22:43 -0400)
committerMike Snitzer <snitzer@kernel.org>
Thu, 4 Aug 2022 18:02:20 +0000 (14:02 -0400)
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>
drivers/md/dm-verity-target.c

index d287d01..5a4ee32 100644 (file)
@@ -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) {
                                /*