[Devel] [PATCH RHEL8 COMMIT] ploop: Introduce init_prq_and_embedded_pio()

Konstantin Khorenko khorenko at virtuozzo.com
Thu Aug 5 18:28:22 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.2
------>
commit 0aec59462c8450621d40814f5f3133eaf67e38cc
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Aug 5 18:28:22 2021 +0300

    ploop: Introduce init_prq_and_embedded_pio()
    
    ... and move init_pio() up
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ====================
    Patchset descrition:
    
    ploop: Handle falloc ENOSPC
    
     #PSBM-106554 added fallocation of whole cluster.
    This case also may fail with -ENOSPC. We need
    to resubmit pio after that in the same way as
    it's done in #PSBM-127225.
    
    https://jira.sw.ru/browse/PSBM-131771
    
    Kirill Tkhai (3):
          ploop: Introduce init_prq_and_embedded_pio()
          ploop: Handle ENOSPC in prq_endio()
          ploop: Pass actual error from allocate_cluster()
---
 drivers/md/dm-ploop-map.c | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 81360e5e66ba..4ef07f2d3fbb 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -104,6 +104,30 @@ static int ploop_rq_valid(struct ploop *ploop, struct request *rq)
 	return 0;
 }
 
+static void init_prq(struct ploop_rq *prq, struct request *rq)
+{
+	prq->rq = rq;
+	prq->bvec = NULL;
+	prq->css = NULL;
+#ifdef CONFIG_BLK_CGROUP
+	if (rq->bio && rq->bio->bi_blkg) {
+		prq->css = &bio_blkcg(rq->bio)->css;
+		css_get(prq->css); /* css_put is in prq_endio */
+	}
+#endif
+}
+
+static void init_prq_and_embedded_pio(struct ploop *ploop, struct request *rq,
+				      struct ploop_rq *prq, struct pio *pio)
+{
+	init_prq(prq, rq);
+	init_pio(ploop, req_op(rq), pio);
+	pio->css = prq->css;
+
+	pio->endio_cb = prq_endio;
+	pio->endio_cb_data = prq;
+}
+
 void prq_endio(struct pio *pio, void *prq_ptr, blk_status_t bi_status)
 {
         struct ploop_rq *prq = prq_ptr;
@@ -1793,19 +1817,6 @@ void do_ploop_fsync_work(struct work_struct *ws)
 	}
 }
 
-static void init_prq(struct ploop_rq *prq, struct request *rq)
-{
-	prq->rq = rq;
-	prq->bvec = NULL;
-	prq->css = NULL;
-#ifdef CONFIG_BLK_CGROUP
-	if (rq->bio && rq->bio->bi_blkg) {
-		prq->css = &bio_blkcg(rq->bio)->css;
-		css_get(prq->css); /* css_put is in prq_endio */
-	}
-#endif
-}
-
 static void submit_embedded_pio(struct ploop *ploop, struct pio *pio)
 {
 	struct ploop_rq *prq = embedded_pio_to_prq(pio);
@@ -1858,13 +1869,8 @@ int ploop_clone_and_map(struct dm_target *ti, struct request *rq,
 		return DM_MAPIO_KILL;
 
 	prq = map_info_to_embedded_prq(info);
-	init_prq(prq, rq);
-
 	pio = map_info_to_embedded_pio(info);
-	init_pio(ploop, req_op(rq), pio);
-	pio->css = prq->css;
-	pio->endio_cb = prq_endio;
-	pio->endio_cb_data = prq;
+	init_prq_and_embedded_pio(ploop, rq, prq, pio);
 
 	submit_embedded_pio(ploop, pio);
 	return DM_MAPIO_SUBMITTED;


More information about the Devel mailing list