[Devel] [PATCH RHEL8 COMMIT] ploop: Unify process_delta_wb()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 29 16:08:16 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.50
------>
commit 52c0cb72a7bf7adda1a5c1d61755b080bf3e7e11
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Jun 29 16:08:16 2021 +0300

    ploop: Unify process_delta_wb()
    
    Make it in the same way as we have in process_deferred_pios()
    and process_discard_pios()
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ==========================
    Preparation for #PSBM-124550 (part 2)
    
    Kirill Tkhai (14):
          ploop: Kill "get_delta_name" alias
          ploop: Use initial pio for COW
          ploop: Rename cluster_pio into aux_pio
          ploop: Shorten variable names
          ploop: Rename in submit_cluster_write()
          ploop: Use defer_pios() instead of manual code
          ploop: Use array of pios instead of separate lists
          ploop: Generalize dispatch_pios usage
          ploop: Unify process_delta_wb()
          ploop: Remove unused struct member
          ploop: Rename page_nr
          ploop: Return md page from ploop_bat_entries()
          ploop: Kill dead check in ploop_attach_end_action()
          ploop: Delay bio if md page is BUSY
---
 drivers/md/dm-ploop-map.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 2338c610893c..5ae981f64ece 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1269,19 +1269,16 @@ static void submit_cow_index_wb(struct ploop_cow *cow,
 	complete_cow(cow, BLK_STS_RESOURCE);
 }
 
-static void process_delta_wb(struct ploop *ploop, struct ploop_index_wb *piwb)
+static void process_delta_wb(struct ploop *ploop, struct list_head *cow_list,
+			     struct ploop_index_wb *piwb)
 {
-	struct list_head *list = &ploop->pios[PLOOP_LIST_COW];
-	struct pio *aux_pio;
 	struct ploop_cow *cow;
-	LIST_HEAD(cow_list);
+	struct pio *aux_pio;
 
-	if (list_empty(list))
+	if (list_empty(cow_list))
 		return;
-	list_splice_tail_init(list, &cow_list);
-	spin_unlock_irq(&ploop->deferred_lock);
 
-	while ((aux_pio = pio_list_pop(&cow_list)) != NULL) {
+	while ((aux_pio = pio_list_pop(cow_list)) != NULL) {
 		cow = aux_pio->endio_cb_data;
 		if (unlikely(aux_pio->bi_status != BLK_STS_OK)) {
 			complete_cow(cow, aux_pio->bi_status);
@@ -1302,8 +1299,6 @@ static void process_delta_wb(struct ploop *ploop, struct ploop_index_wb *piwb)
 			submit_cow_index_wb(cow, piwb);
 		}
 	}
-
-	spin_lock_irq(&ploop->deferred_lock);
 }
 
 /*
@@ -1537,6 +1532,7 @@ void do_ploop_work(struct work_struct *ws)
 	struct ploop_index_wb piwb;
 	LIST_HEAD(deferred_pios);
 	LIST_HEAD(discard_pios);
+	LIST_HEAD(cow_pios);
 	unsigned int pf_io_thread = (current->flags & PF_IO_THREAD);
 
 	current->flags |= PF_IO_THREAD;
@@ -1552,14 +1548,14 @@ void do_ploop_work(struct work_struct *ws)
 	ploop_index_wb_init(&piwb, ploop);
 
 	spin_lock_irq(&ploop->deferred_lock);
-	process_delta_wb(ploop, &piwb);
-
 	list_splice_init(&ploop->pios[PLOOP_LIST_DEFERRED], &deferred_pios);
 	list_splice_init(&ploop->pios[PLOOP_LIST_DISCARD], &discard_pios);
+	list_splice_init(&ploop->pios[PLOOP_LIST_COW], &cow_pios);
 	spin_unlock_irq(&ploop->deferred_lock);
 
 	process_deferred_pios(ploop, &deferred_pios, &piwb);
 	process_discard_pios(ploop, &discard_pios, &piwb);
+	process_delta_wb(ploop, &cow_pios, &piwb);
 
 	if (piwb.page_nr != PAGE_NR_NONE) {
 		/* Index wb was prepared -- submit and wait it */


More information about the Devel mailing list