[Devel] [PATCH vz9 v1 37/63] dm-ploop: make ploop_submit_metadata_writeback return number of requests sent

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Jan 24 18:36:11 MSK 2025


We need to wait for write back to complete to issue pending flushes.
To know if we have to wait return numer of pios submitted.
Check if we have pending pios blocked by md update.

https://virtuozzo.atlassian.net/browse/VSTOR-91821
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 86c7b7b946b2..f59889d2cd89 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1894,7 +1894,7 @@ static void ploop_process_resubmit_pios(struct ploop *ploop,
 	}
 }
 
-static void ploop_submit_metadata_writeback(struct ploop *ploop)
+static int ploop_submit_metadata_writeback(struct ploop *ploop)
 {
 	unsigned long flags;
 	LIST_HEAD(ll_skipped);
@@ -1902,11 +1902,13 @@ static void ploop_submit_metadata_writeback(struct ploop *ploop)
 	struct md_page *md;
 	struct llist_node *pos, *t;
 	struct llist_node *ll_wb_batch;
+	int ret = 0;
 
 	/* Lock here to protect against md_inflight counting */
 	spin_lock_irqsave(&ploop->bat_lock, flags);
 	ll_wb_batch = llist_del_all(&ploop->wb_batch_llist);
 	spin_unlock_irqrestore(&ploop->bat_lock, flags);
+
 	/*
 	 * Pages are set dirty so no one must touch lists
 	 * if new md entries are dirtied they are added at the start of the list
@@ -1930,6 +1932,7 @@ static void ploop_submit_metadata_writeback(struct ploop *ploop)
 			llist_add((struct llist_node *)&md->wb_link, &ploop->wb_batch_llist);
 		}
 	}
+	return ret;
 }
 
 static void process_ploop_fsync_work(struct ploop *ploop, struct llist_node *llflush_pios)
-- 
2.43.0



More information about the Devel mailing list