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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 17 19:01:02 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.44
------>
commit b871b2eb5b3449981a535c8a90558f910c0db3b4
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Jun 17 19:01:02 2021 +0300

    ploop: Refactor submit_pio()
    
    Make only "list_splice_tail" entry point for both workers.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Allow to resubmit partially completed request
    
    This allows to continue submitting partially completed requests.
    
    https://jira.sw.ru/browse/PSBM-127225
    
    Kirill Tkhai (18):
          ploop: Simplify ploop_write_cluster_sync()
          ploop: Rename hook->pio, h->pio, ploop_cow::hook->aux_pio
          ploop: Rename force_link_inflight_bios
          ploop: Introduce separate lock for inflight pios
          ploop: Use hlist instead of rbtree
          ploop: Always link submitted pios
          ploop: Unexport ploop_inflight_bios_ref_switch()
          ploop: Refactor submit_pio()
          ploop: Introduce ploop_suspend_submitting_pios
          ploop: Refactor ploop_ctr()
          ploop: Use ploop_call_rw_iter() in submit_delta_read()
          ploop: Generalize submit_rw_mapped()
          ploop: Kill submit_delta_read()
          ploop: Rename submit_rw_mapped()
          ploop: Extract submit_rw_mapped() to separate function
          ploop: Save level before submitting pio
          ploop: Make fsync work be able to run in parallel with main work
          ploop: Introduce resubmitting partially completed pios
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index ef37874e8991..73d44122361b 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1632,11 +1632,16 @@ static noinline struct bio_vec *create_bvec_from_rq(struct request *rq)
 
 static noinline void submit_pio(struct ploop *ploop, struct pio *pio)
 {
+	struct list_head *queue_list;
+	struct work_struct *worker;
 	unsigned long flags;
 	LIST_HEAD(list);
 	int ret;
 
 	if (pio->bi_iter.bi_size) {
+		queue_list = &ploop->deferred_pios;
+		worker = &ploop->worker;
+
 		if (ploop_pio_valid(ploop, pio) < 0)
 			goto kill;
 
@@ -1645,20 +1650,20 @@ static noinline void submit_pio(struct ploop *ploop, struct pio *pio)
 			pio->bi_status = BLK_STS_RESOURCE;
 			goto endio;
 		}
-		list_add(&pio->list, &list);
+	} else {
+		queue_list = &ploop->flush_pios;
+		worker = &ploop->fsync_worker;
 
-		defer_pios(ploop, NULL, &list);
-		goto out;
+		if (WARN_ON_ONCE(pio->bi_op != REQ_OP_FLUSH))
+			goto kill;
 	}
 
-	if (WARN_ON_ONCE(pio->bi_op != REQ_OP_FLUSH))
-		goto kill;
+	list_add(&pio->list, &list);
 
 	spin_lock_irqsave(&ploop->deferred_lock, flags);
-	list_add_tail(&pio->list, &ploop->flush_pios);
+	list_splice_tail(&list, queue_list);
 	spin_unlock_irqrestore(&ploop->deferred_lock, flags);
-	queue_work(ploop->wq, &ploop->fsync_worker);
-out:
+	queue_work(ploop->wq, worker);
 	return;
 kill:
 	pio->bi_status = BLK_STS_IOERR;


More information about the Devel mailing list