[Devel] [PATCH RHEL9 COMMIT] dm-qcow2: Extend status line - show qcow2 version and cluster size

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 16 17:48:29 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.28
------>
commit 888aba46c250c8373fc95b7fad8edf2010cc90a9
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Nov 16 17:48:29 2021 +0300

    dm-qcow2: Extend status line - show qcow2 version and cluster size
    
    Add QCOW2 version and cluster size for top image.
    
    The status line can be check using following command:
      dmsetup table ploopXXX
    
    Q: Why do we need that info in the status line?
    A: For unification with ploop (see ploop_status())
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-qcow2-target.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index c41f623fb7d7..b6915edd6a3c 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -837,16 +837,23 @@ static void qcow2_status(struct dm_target *ti, status_type_t type,
 			 unsigned int maxlen)
 {
 	struct qcow2_target *tgt = to_qcow2_target(ti);
+	struct QCowHeader *hdr;
 	unsigned int sz = 0;
+	struct qcow2 *qcow2;
+	u8 ref_index;
 
+	qcow2 = qcow2_ref_inc(tgt, &ref_index);
+	hdr = &qcow2->hdr;
 	switch (type) {
 	case STATUSTYPE_INFO:
 		result[0] = '\0';
 		break;
 	case STATUSTYPE_TABLE:
-		DMEMIT("%u", tgt->nr_images);
+		DMEMIT("%u v%u %llu", tgt->nr_images, hdr->version,
+				      to_sector(qcow2->clu_size));
 		break;
 	}
+	qcow2_ref_dec(tgt, ref_index);
 }
 
 static void qcow2_presuspend(struct dm_target *ti)


More information about the Devel mailing list