[PATCH 3/5] dm-verity: revert e9307e3deb52 ("dm verity: only copy bvec_iter in verity_verify_io if in_tasklet")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch e9307e3deb52 was supposed to be an optimization, but it actually
increases the size of the function verity_verify_io (by 112 bytes), so
let's revert it.

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

---
 drivers/md/dm-verity-target.c |   21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

Index: linux-2.6/drivers/md/dm-verity-target.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-verity-target.c	2024-02-06 14:46:59.000000000 +0100
+++ linux-2.6/drivers/md/dm-verity-target.c	2024-02-06 14:50:50.000000000 +0100
@@ -565,22 +565,11 @@ static int verity_verify_io(struct dm_ve
 	bool is_zero;
 	struct dm_verity *v = io->v;
 	struct bvec_iter start;
-	struct bvec_iter iter_copy;
-	struct bvec_iter *iter;
+	struct bvec_iter iter_copy = io->iter;
 	struct crypto_wait wait;
 	struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
 	unsigned int b;
 
-	if (static_branch_unlikely(&use_tasklet_enabled) && io->in_tasklet) {
-		/*
-		 * Copy the iterator in case we need to restart
-		 * verification in a work-queue.
-		 */
-		iter_copy = io->iter;
-		iter = &iter_copy;
-	} else
-		iter = &io->iter;
-
 	for (b = 0; b < io->n_blocks; b++) {
 		int r;
 		sector_t cur_block = io->block + b;
@@ -588,7 +577,7 @@ static int verity_verify_io(struct dm_ve
 
 		if (v->validated_blocks && bio->bi_status == BLK_STS_OK &&
 		    likely(test_bit(cur_block, v->validated_blocks))) {
-			verity_bv_skip_block(v, io, iter);
+			verity_bv_skip_block(v, io, &iter_copy);
 			continue;
 		}
 
@@ -603,7 +592,7 @@ static int verity_verify_io(struct dm_ve
 			 * If we expect a zero block, don't validate, just
 			 * return zeros.
 			 */
-			r = verity_for_bv_block(v, io, iter,
+			r = verity_for_bv_block(v, io, &iter_copy,
 						verity_bv_zero);
 			if (unlikely(r < 0))
 				return r;
@@ -615,8 +604,8 @@ static int verity_verify_io(struct dm_ve
 		if (unlikely(r < 0))
 			return r;
 
-		start = *iter;
-		r = verity_for_io_block(v, io, iter, &wait);
+		start = iter_copy;
+		r = verity_for_io_block(v, io, &iter_copy, &wait);
 		if (unlikely(r < 0))
 			return r;
 





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux