[Devel] [PATCH RHEL8 COMMIT] dm-qcow2: Use cow_read_endio() in submit_read_compressed()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 13 15:26:53 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.6
------>
commit 7079be5103b37416311466c35382a76575cd92b5
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Aug 13 15:26:53 2021 +0300

    dm-qcow2: Use cow_read_endio() in submit_read_compressed()
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ====================
    It's a preparation for https://jira.sw.ru/browse/PSBM-132049
---
 drivers/md/dm-qcow2-map.c | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 50b175f57fee..b31d1f770942 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -2766,16 +2766,18 @@ static void perform_rw_mapped(struct qcow2_map *map, struct qio *qio)
 	map_and_submit_rw(qcow2, map->data_clu_pos, qio);
 }
 
-static void cow_read_complete(struct qio *qio)
+static void cow_read_endio(struct qcow2_target *tgt, struct qio *unused,
+			   void *qio_ptr, blk_status_t bi_status)
+
 {
+	struct qio *qio = qio_ptr;
 	struct md_page *md = qio->ext->lx_md;
 	struct qcow2 *qcow2 = qio->qcow2;
-	int ret = qio->ret;
 
 	dec_wpc_readers(qcow2, md); /* We ended to use shared clu on disk */
 
-	if (qio->ret != qcow2->clu_size) {
-		qio->bi_status = errno_to_blk_status(ret < 0 ? ret : -EIO);
+	if (unlikely(bi_status)) {
+		qio->bi_status = bi_status;
 		qio_endio(qio);
 		return;
 	}
@@ -2784,21 +2786,6 @@ static void cow_read_complete(struct qio *qio)
 	dispatch_qios(qio->qcow2, qio, NULL);
 }
 
-static void cow_read_endio(struct qcow2_target *tgt, struct qio *unused,
-			   void *qio_ptr, blk_status_t bi_status)
-
-{
-	struct qio *qio = qio_ptr;
-	struct qcow2 *qcow2 = qio->qcow2;
-
-	if (bi_status)
-		qio->ret = blk_status_to_errno(bi_status);
-	else
-		qio->ret = qcow2->clu_size;
-
-	cow_read_complete(qio);
-}
-
 static void submit_read_whole_cow_clu(struct qcow2_map *map, struct qio *qio)
 {
 	loff_t clu_pos = map->cow_clu_pos;
@@ -3036,10 +3023,9 @@ static void submit_read_compressed(struct qcow2_map *map, struct qio *qio,
 		 * Optimization: do not read clu from disk
 		 * in case of here is complete clu rewrite.
 		 * See the way process_cow_data_write()
-		 * updates qvec.
+		 * updates qvec. Also skips extract part.
 		 */
-		qio->ret = clu_size;
-		cow_read_complete(qio); /* Also skip extract part */
+		cow_read_endio(qcow2->tgt, NULL, qio, BLK_STS_OK);
 		return;
 	}
 


More information about the Devel mailing list