[Devel] [PATCH RH8] dm-qcow2: Avoid reading R1R2 pages if cluster is not COW

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jul 22 15:08:58 MSK 2021


This had been enabled before COW clusters became supported
for debug purposes (to introduce R1R2 support initially).
Now, it is not needed, since that code is tested on real
compressed or internal snapshot clusters COW.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-qcow2-map.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index d6e1c08c8fb3..e14d083fd532 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -1919,12 +1919,10 @@ static int parse_metadata(struct qcow2 *qcow2, struct qio **qio,
 		return pos;
 
 	map->data_clu_pos = pos;
-	if (!write)
+	if (!write || !map->clu_is_cow)
 		return 0;
 
 	/* Now refcounters table/block */
-	if (!qcow2->hdr.nb_snapshots && !map->compressed)
-		return 0;
 	ret = handle_r1r2_maps(qcow2, pos, qio, &map->r1,
 			       &map->r2, map->compressed);
 	return ret < 0 ? ret : 0;




More information about the Devel mailing list