[Devel] [PATCH RH8 04/10] ploop: Make split_pios_to_list() to add initial pio to the list too

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


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index a4cc8de169c4..692cf1e80936 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -196,10 +196,11 @@ static struct pio * split_and_chain_pio(struct ploop *ploop,
 }
 
 static int split_pio_to_list(struct ploop *ploop, struct pio *pio,
-			     struct list_head *list)
+			     struct list_head *ret_list)
 {
 	u32 clu_size = CLU_SIZE(ploop);
 	struct pio *split;
+	LIST_HEAD(list);
 
 	while (1) {
 		loff_t start = to_bytes(pio->bi_iter.bi_sector);
@@ -217,12 +218,14 @@ static int split_pio_to_list(struct ploop *ploop, struct pio *pio,
 		if (!split)
 			goto err;
 
-		list_add_tail(&split->list, list);
+		list_add_tail(&split->list, &list);
 	}
 
+	list_splice_tail(&list, ret_list);
+	list_add_tail(&pio->list, ret_list);
 	return 0;
 err:
-	while ((pio = pio_list_pop(list)) != NULL) {
+	while ((pio = pio_list_pop(&list)) != NULL) {
 		pio->bi_status = BLK_STS_RESOURCE;
 		pio_endio(pio);
 	}
@@ -1737,10 +1740,9 @@ static void submit_pio(struct ploop *ploop, struct pio *pio)
 
 		if (WARN_ON_ONCE(pio->bi_op != REQ_OP_FLUSH))
 			goto kill;
+		list_add_tail(&pio->list, &list);
 	}
 
-	list_add(&pio->list, &list);
-
 	spin_lock_irqsave(&ploop->deferred_lock, flags);
 	if (unlikely(ploop->stop_submitting_pios)) {
 		list_splice_tail(&list, &ploop->suspended_pios);




More information about the Devel mailing list