[Devel] [PATCH RH9 3/9] dm-qcow2: Introduce fake_service_qio()

Kirill Tkhai ktkhai at virtuozzo.com
Sun Mar 6 13:28:11 MSK 2022


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-qcow2-cmd.c |    2 +-
 drivers/md/dm-qcow2-map.c |    5 ++---
 drivers/md/dm-qcow2.h     |    5 +++++
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-qcow2-cmd.c b/drivers/md/dm-qcow2-cmd.c
index 14b633cf3258..45a114c74748 100644
--- a/drivers/md/dm-qcow2-cmd.c
+++ b/drivers/md/dm-qcow2-cmd.c
@@ -74,7 +74,7 @@ static int qcow2_service_iter(struct qcow2_target *tgt, struct qcow2 *qcow2,
 			break;
 		}
 
-		/* See fake_merge_qio() and fake_l1cow_qio() */
+		/* See fake_service_qio() */
 		init_qio(qio, bi_op, qcow2);
 		qio->flags |= qio_flags|QIO_FREE_ON_ENDIO_FL;
 		qio->bi_io_vec = &bvec;
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 5c0bf98ec8ad..4e04505810fc 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -993,8 +993,7 @@ static int calc_cluster_map(struct qcow2 *qcow2, struct qio *qio,
 	loff_t pos;
 
 	if (unlikely(start / clu_size != (end - 1) / clu_size &&
-		     (start != end || (!fake_merge_qio(qio) &&
-				       !fake_l1cow_qio(qio)))))
+		     (start != end || !fake_service_qio(qio))))
 		goto eio;
 	if (unlikely(end > qcow2->hdr.size))
 		goto eio;
@@ -1819,7 +1818,7 @@ static loff_t parse_l2(struct qcow2 *qcow2, struct qcow2_map *map,
 					      l2->index_in_page + 1);
 		map->ext_l2 = ext_l2;
 		map->subclus_mask = 0;
-		if (!fake_merge_qio(*qio) && !fake_l1cow_qio(*qio))
+		if (!fake_service_qio(*qio))
 			map->subclus_mask = qio_subclus_mask(qcow2, *qio);
 
 		if (WARN_ON_ONCE(all_zeroes || (ext_l2 & (ext_l2 >> 32))))
diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h
index f560ea9b3030..794e091ccf97 100644
--- a/drivers/md/dm-qcow2.h
+++ b/drivers/md/dm-qcow2.h
@@ -346,6 +346,11 @@ static inline bool fake_l1cow_qio(struct qio *qio)
 		(qio->flags & QIO_IS_L1COW_FL));
 }
 
+static inline bool fake_service_qio(struct qio *qio)
+{
+	return fake_merge_qio(qio) || fake_l1cow_qio(qio);
+}
+
 static inline bool qcow2_wants_check(struct qcow2_target *tgt)
 {
 




More information about the Devel mailing list