[Devel] [PATCH RHEL8 COMMIT] ploop: Add md and piwb cross pointers

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

    ploop: Add md and piwb cross pointers
    
    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-bat.c |  1 +
 drivers/md/dm-ploop-map.c | 14 +++++++++++++-
 drivers/md/dm-ploop.h     |  2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index 602842b2440c..b445663c8be6 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -81,6 +81,7 @@ static struct md_page * alloc_md_page(unsigned int id)
 	INIT_LIST_HEAD(&md->wait_list);
 
 	md->bat_levels = levels;
+	md->piwb = NULL;
 	md->page = page;
 	md->id = id;
 	return md;
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index a2737e9beac3..8b2fc152eb77 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -44,6 +44,7 @@ void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop)
 	piwb->ploop = ploop;
 	init_completion(&piwb->comp);
 	spin_lock_init(&piwb->lock);
+	piwb->md = NULL;
 	piwb->bat_page = NULL;
 	piwb->bi_status = 0;
 	INIT_LIST_HEAD(&piwb->ready_data_pios);
@@ -642,8 +643,8 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
 					     struct ploop_index_wb *piwb,
 					     bool success)
 {
-	struct md_page *md = md_page_find(ploop, piwb->page_id);
 	unsigned int i, last, *bat_entries;
+	struct md_page *md = piwb->md;
 	map_index_t *dst_clu, off;
 	unsigned long flags;
 	LIST_HEAD(list);
@@ -778,6 +779,11 @@ static int ploop_prepare_bat_update(struct ploop *ploop, unsigned int page_id,
 	BUG_ON(!md);
 	bat_entries = kmap_atomic(md->page);
 
+	write_lock_irq(&ploop->bat_rwlock);
+	md->piwb = piwb;
+	piwb->md = md;
+	write_unlock_irq(&ploop->bat_rwlock);
+
 	piwb->page_id = page_id;
 	to = kmap_atomic(page);
 	memcpy((void *)to, bat_entries, PAGE_SIZE);
@@ -816,6 +822,12 @@ static int ploop_prepare_bat_update(struct ploop *ploop, unsigned int page_id,
 void ploop_reset_bat_update(struct ploop_index_wb *piwb)
 {
 	struct ploop *ploop = piwb->ploop;
+	unsigned long flags;
+
+	write_lock_irqsave(&ploop->bat_rwlock, flags);
+	piwb->md->piwb = NULL;
+	piwb->md = NULL;
+	write_unlock_irqrestore(&ploop->bat_rwlock, flags);
 
 	put_page(piwb->bat_page);
 	ploop_index_wb_init(piwb, ploop);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 698da3f887e4..879d7c5b25e7 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -96,6 +96,7 @@ struct ploop_index_wb {
 	struct completion comp;
 	enum piwb_type type;
 	spinlock_t lock;
+	struct md_page *md;
 	struct page *bat_page;
 	struct list_head ready_data_pios;
 	struct list_head cow_list;
@@ -112,6 +113,7 @@ struct md_page {
 	struct page *page;
 	u8 *bat_levels;
 	struct list_head wait_list;
+	struct ploop_index_wb *piwb;
 };
 
 enum {


More information about the Devel mailing list