[Devel] [PATCH RHEL8 COMMIT] ploop: Refactor ploop_endio()

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 17 19:05:04 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.30
------>
commit b937acedaababca802487f56d3d4d7569b34ea73
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 17 19:05:04 2021 +0300

    ploop: Refactor ploop_endio()
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    dm-ploop: Kill loop
    
    Intermediate patches can't be base for bisect.
    
    In scope of https://jira.sw.ru/browse/PSBM-123654
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index a0bbb4607923..c471b621e1b5 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -34,7 +34,7 @@
  */
 
 extern void dm_request_set_error(struct request *rq, blk_status_t error);
-static int ploop_endio(struct ploop *ploop, struct pio *pio);
+static void ploop_endio(struct ploop *ploop, struct pio *pio);
 
 #define DM_MSG_PREFIX "ploop"
 
@@ -134,18 +134,15 @@ static void prq_endio(struct pio *pio, void *prq_ptr, blk_status_t bi_status)
 {
         struct ploop_rq *prq = prq_ptr;
         struct request *rq = prq->rq;
-	int ret;
 
-	ret = ploop_endio(pio->ploop, pio);
+	ploop_endio(pio->ploop, pio);
 
 	if (bi_status)
 		dm_request_set_error(rq, bi_status);
 
-	if (ret == DM_ENDIO_DONE) {
-	        if (prq->bvec)
-			kfree(prq->bvec);
-	        blk_mq_complete_request(rq);
-	}
+	if (prq->bvec)
+		kfree(prq->bvec);
+	blk_mq_complete_request(rq);
 }
 
 void pio_endio(struct pio *pio)
@@ -532,7 +529,7 @@ static void handle_discard_pio(struct ploop *ploop, struct pio *pio,
 	queue_discard_index_wb(ploop, pio);
 }
 
-static int ploop_discard_index_pio_end(struct ploop *ploop, struct pio *pio)
+static void ploop_discard_index_pio_end(struct ploop *ploop, struct pio *pio)
 {
 	del_cluster_lk(ploop, pio);
 
@@ -540,7 +537,6 @@ static int ploop_discard_index_pio_end(struct ploop *ploop, struct pio *pio)
 	/* Pairs with barrier in do_discard_cleanup() */
 	smp_mb__before_atomic();
 	atomic_dec(&ploop->nr_discard_bios);
-	return DM_ENDIO_DONE;
 }
 
 static void complete_cow(struct ploop_cow *cow, blk_status_t bi_status)
@@ -1746,10 +1742,8 @@ int ploop_clone_and_map(struct dm_target *ti, struct request *rq,
 	return DM_MAPIO_SUBMITTED;
 }
 
-static int ploop_endio(struct ploop *ploop, struct pio *pio)
+static void ploop_endio(struct ploop *ploop, struct pio *pio)
 {
-	int ret = DM_ENDIO_DONE;
-
 	if (pio->ref_index != PLOOP_REF_INDEX_INVALID) {
 		/*
 		 * This function may be called twice for discard
@@ -1768,14 +1762,10 @@ static int ploop_endio(struct ploop *ploop, struct pio *pio)
 	 * directly later again.
 	 */
 	if (pio->action == PLOOP_END_IO_DISCARD_INDEX_BIO)
-		ret = ploop_discard_index_pio_end(ploop, pio);
+		ploop_discard_index_pio_end(ploop, pio);
 
-	if (ret == DM_ENDIO_DONE) {
-		maybe_unlink_completed_pio(ploop, pio);
-		dec_nr_inflight(ploop, pio);
-	}
-
-	return ret;
+	maybe_unlink_completed_pio(ploop, pio);
+	dec_nr_inflight(ploop, pio);
 }
 
 /*


More information about the Devel mailing list