[Devel] [PATCH RHEL8 COMMIT] ploop: Do fsync after bat page write

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 2 22:43:32 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 5a9b7f76aa570fcf605748c17e152f8213725370
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jul 2 22:43:31 2021 +0300

    ploop: Do fsync after bat page write
    
    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 | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c48dc28691ea..6bd7bd087f4a 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1477,16 +1477,35 @@ static int process_one_deferred_bio(struct ploop *ploop, struct pio *pio)
 	return 0;
 }
 
+static void md_fsync_endio(struct pio *pio, void *piwb_ptr, blk_status_t bi_status)
+{
+	struct ploop_index_wb *piwb = piwb_ptr;
+
+	ploop_bat_write_complete(piwb, bi_status);
+}
+
 static void md_write_endio(struct pio *pio, void *piwb_ptr, blk_status_t bi_status)
 {
 	struct ploop_index_wb *piwb = piwb_ptr;
 	struct ploop *ploop = piwb->ploop;
+	unsigned long flags;
 	u32 dst_clu;
 
 	dst_clu = POS_TO_CLU(ploop, (u64)piwb->page_id << PAGE_SHIFT);
 	track_dst_cluster(ploop, dst_clu);
 
-	ploop_bat_write_complete(piwb, bi_status);
+	if (bi_status) {
+		md_fsync_endio(pio, piwb, bi_status);
+	} else {
+		init_pio(ploop, REQ_OP_FLUSH, pio);
+		pio->endio_cb = md_fsync_endio;
+		pio->endio_cb_data = piwb;
+
+		spin_lock_irqsave(&ploop->deferred_lock, flags);
+		list_add_tail(&pio->list, &ploop->flush_pios);
+		spin_unlock_irqrestore(&ploop->deferred_lock, flags);
+		queue_work(ploop->wq, &ploop->fsync_worker);
+	}
 }
 
 void ploop_index_wb_submit(struct ploop *ploop, struct ploop_index_wb *piwb)


More information about the Devel mailing list