[Devel] [PATCH RHEL8 COMMIT] ploop: Refactoring in process_one_discard_pio()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 2 22:43:24 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.6.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.el8
------>
commit be92f556a53cda13acd4125b23d85e2781aa16a1
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jul 2 22:43:24 2021 +0300

    ploop: Refactoring in process_one_discard_pio()
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ==========================
    Parallel async BAT pages submission and improvements
    
    [1-15]:
    https://jira.sw.ru/browse/PSBM-124550
    
    [16-22]:
    following improvements
    
    Kirill Tkhai (22):
          ploop: Remove absolet comment
          ploop: Add md and piwb cross pointers
          ploop: Add @md argument to locate_new_cluster_and_attach_pio()
          ploop: Refactoring in process_one_discard_pio()
          ploop: Pass type argument to ploop_prepare_bat_update()
          ploop: Move md is busy check to delay_if_md_busy()
          ploop: Introduce batch list for md pages writeback
          ploop: Check for md dirty instead of md piwb
          ploop: Reread piwb after ploop_prepare_bat_update()
          ploop: Change argument in ploop_prepare_bat_update()
          ploop: Return md from ploop_prepare_reloc_index_wb()
          ploop: Change arguments and rename ploop_reset_bat_update()
          ploop: Allow parallel wb of md pages
          ploop: Async md writeback
          ploop: Rename ploop_submit_index_wb_sync()
          ploop: Resubmit pios from main kwork
          ploop: Rename process_delta_wb()
          ploop: Do fsync after bat page write
          ploop: Do not iterate excess clusters in notify_delta_merged()
          ploop: Use kvec in ploop_delta_check_header()
          ploop: Add argument to ploop_read_delta_metadata()
          ploop: Underline clu and page is u32
---
 drivers/md/dm-ploop-map.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index b001cf295f57..1b1313a8b057 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1461,26 +1461,23 @@ static void process_deferred_pios(struct ploop *ploop, struct list_head *pios,
 		process_one_deferred_bio(ploop, pio, piwb);
 }
 
-static int process_one_discard_pio(struct ploop *ploop, struct pio *pio,
-				   struct ploop_index_wb *piwb)
+static void process_one_discard_pio(struct ploop *ploop, struct pio *pio,
+				    struct ploop_index_wb *piwb)
 {
-	unsigned int page_id, clu;
-	bool bat_update_prepared;
+	unsigned int page_id, clu = pio->clu;
+	bool bat_update_prepared = false;
 	struct md_page *md;
 	map_index_t *to;
 
 	WARN_ON(ploop->nr_deltas != 1);
 
-	clu = pio->clu;
 	page_id = bat_clu_to_page_nr(clu);
-	bat_update_prepared = false;
 
 	if (piwb->page_id == PAGE_NR_NONE) {
 		/* No index wb in process. Prepare a new one */
 		if (ploop_prepare_bat_update(ploop, page_id, piwb) < 0) {
 			pio->bi_status = BLK_STS_RESOURCE;
-			pio_endio(pio);
-			goto out;
+			goto err;
 		}
 		piwb->type = PIWB_TYPE_DISCARD;
 		bat_update_prepared = true;
@@ -1499,16 +1496,18 @@ static int process_one_discard_pio(struct ploop *ploop, struct pio *pio,
 	to = kmap_atomic(piwb->bat_page);
 	if (WARN_ON_ONCE(!to[clu])) {
 		pio->bi_status = BLK_STS_IOERR;
-		pio_endio(pio);
-		if (bat_update_prepared)
-			ploop_reset_bat_update(piwb);
+		goto err;
 	} else {
 		to[clu] = 0;
 		list_add_tail(&pio->list, &piwb->ready_data_pios);
 	}
 	kunmap_atomic(to);
 out:
-	return 0;
+	return;
+err:
+	if (bat_update_prepared)
+		ploop_reset_bat_update(piwb);
+	pio_endio(pio);
 }
 
 static void process_discard_pios(struct ploop *ploop, struct list_head *pios,


More information about the Devel mailing list