[Devel] [PATCH RH8 02/10] ploop: Manage flush pios in generic way

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jun 30 19:46:20 MSK 2021


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c    |    6 +++---
 drivers/md/dm-ploop-target.c |    1 -
 drivers/md/dm-ploop.h        |    4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 1341806dc6c4..5c8375636eac 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1496,7 +1496,7 @@ static void md_write_endio(struct pio *pio, void *piwb_ptr, blk_status_t bi_stat
 		pio->endio_cb_data = piwb;
 
 		spin_lock_irqsave(&ploop->deferred_lock, flags);
-		list_add_tail(&pio->list, &ploop->flush_pios);
+		list_add_tail(&pio->list, &ploop->pios[PLOOP_LIST_FLUSH]);
 		spin_unlock_irqrestore(&ploop->deferred_lock, flags);
 		queue_work(ploop->wq, &ploop->fsync_worker);
 	}
@@ -1661,7 +1661,7 @@ void do_ploop_fsync_work(struct work_struct *ws)
 	int ret;
 
 	spin_lock_irq(&ploop->deferred_lock);
-	list_splice_init(&ploop->flush_pios, &flush_pios);
+	list_splice_init(&ploop->pios[PLOOP_LIST_FLUSH], &flush_pios);
 	spin_unlock_irq(&ploop->deferred_lock);
 
 	file = top_delta(ploop)->file;
@@ -1725,7 +1725,7 @@ static void submit_pio(struct ploop *ploop, struct pio *pio)
 			goto endio;
 		}
 	} else {
-		queue_list = &ploop->flush_pios;
+		queue_list = &ploop->pios[PLOOP_LIST_FLUSH];
 		worker = &ploop->fsync_worker;
 
 		if (WARN_ON_ONCE(pio->bi_op != REQ_OP_FLUSH))
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 705f2252e822..c69e18bfa13d 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -330,7 +330,6 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	for (i = 0; i < PLOOP_LIST_COUNT; i++)
 		INIT_LIST_HEAD(&ploop->pios[i]);
 
-	INIT_LIST_HEAD(&ploop->flush_pios);
 	INIT_LIST_HEAD(&ploop->resubmit_pios);
 	INIT_LIST_HEAD(&ploop->enospc_pios);
 	INIT_LIST_HEAD(&ploop->cluster_lk_list);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 50663d8aa219..8b5156128889 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -124,6 +124,7 @@ struct md_page {
 
 enum {
 	PLOOP_LIST_DEFERRED = 0,
+	PLOOP_LIST_FLUSH,
 	PLOOP_LIST_DISCARD,
 	PLOOP_LIST_COW,
 
@@ -188,7 +189,6 @@ struct ploop {
 
 	struct list_head pios[PLOOP_LIST_COUNT];
 
-	struct list_head flush_pios;
 	struct list_head resubmit_pios; /* After partial IO */
 	struct list_head enospc_pios; /* Delayed after ENOSPC */
 
@@ -258,7 +258,7 @@ struct pio {
 #define PLOOP_REF_INDEX_INVALID	2
 	unsigned int ref_index:2;
 
-	u8 queue_list_id:2; /* id in ploop->pios */
+	u8 queue_list_id:3; /* id in ploop->pios */
 
 	struct ploop_index_wb *piwb;
 




More information about the Devel mailing list