[Devel] [PATCH RHEL9 COMMIT] dm-qcow2: Introduce a new helper init_qrq_and_embedded_qio()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Mar 2 20:04:13 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-42.vz9.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-42.vz9.14.3
------>
commit df7c73fdd5fc6cf8f746f8cc8cf142ca7a93ac13
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Mar 2 20:04:13 2022 +0300

    dm-qcow2: Introduce a new helper init_qrq_and_embedded_qio()
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Feature: dm-qcow2: block device over QCOW2 files driver
---
 drivers/md/dm-qcow2-map.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 8ec67d2b10c9..60dd5c76ba7c 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -83,6 +83,8 @@ static int punch_hole(struct file *file, loff_t pos, loff_t len);
 static void handle_cleanup_mask(struct qio *qio);
 static void process_read_qio(struct qcow2 *qcow2, struct qio *qio,
 			     struct qcow2_map *map);
+static void init_qrq_and_embedded_qio(struct qcow2_target *tgt, struct request *rq,
+				      struct qcow2_rq *qrq, struct qio *qio);
 
 static loff_t bytes_off_in_cluster(struct qcow2 *qcow2, struct qio *qio)
 {
@@ -4011,6 +4013,16 @@ static void init_qrq(struct qcow2_rq *qrq, struct request *rq)
 	qrq->bvec = NULL;
 }
 
+static void init_qrq_and_embedded_qio(struct qcow2_target *tgt, struct request *rq,
+				      struct qcow2_rq *qrq, struct qio *qio)
+{
+	init_qrq(qrq, rq);
+	init_qio(qio, req_op(rq), NULL);
+
+	qio->endio_cb = qrq_endio;
+	qio->endio_cb_data = qrq;
+}
+
 void submit_embedded_qio(struct qcow2_target *tgt, struct qio *qio)
 {
 	struct qcow2_rq *qrq = qio->endio_cb_data;
@@ -4067,12 +4079,9 @@ int qcow2_clone_and_map(struct dm_target *ti, struct request *rq,
 	qrq = mempool_alloc(tgt->qrq_pool, GFP_ATOMIC);
 	if (!qrq)
 		return DM_MAPIO_KILL;
-	init_qrq(qrq, rq);
-
 	qio = (void *)qrq + sizeof(*qrq);
-	init_qio(qio, req_op(rq), NULL);
-	qio->endio_cb = qrq_endio;
-	qio->endio_cb_data = qrq;
+	init_qrq_and_embedded_qio(tgt, rq, qrq, qio);
+
 	/*
 	 * Note, this qcow2_clone_and_map() may be called from atomic
 	 * context, so here we just delegate qio splitting to kwork.


More information about the Devel mailing list