[Devel] [PATCH RH9 03/12] dm-qcow2: Introduce fake_service_qio()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jan 19 19:17:10 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 9368339d7579..2bcca9f99397 100644
--- a/drivers/md/dm-qcow2-cmd.c
+++ b/drivers/md/dm-qcow2-cmd.c
@@ -76,7 +76,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 f5792073d10e..b9993cc5e736 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -991,8 +991,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;
@@ -1817,7 +1816,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 962b767c84b1..60cb370dcbab 100644
--- a/drivers/md/dm-qcow2.h
+++ b/drivers/md/dm-qcow2.h
@@ -339,6 +339,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