All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: khorenko@virtuozzo.com, andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 1/3] dm-ploop: factor out ploop_dispatch_md_waiters()
Date: Mon,  9 Nov 2026 20:06:02 +0100	[thread overview]
Message-ID: <20261109190604.1850504-2-den@openvz.org> (raw)
In-Reply-To: <20261109190604.1850504-1-den@openvz.org>

From: Denis V. Lunev <den@openvz.org>

Move the loop that hands the pios parked in md->wait_llist back to the
dispatcher out of ploop_advance_local_after_bat_wb() into a helper of
its own, so that the error paths of the BAT updates can use it too.

No functional change.

https://virtuozzo.atlassian.net/browse/VSTOR-154096

Feature: dm-ploop: ploop target driver
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 drivers/md/dm-ploop-map.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index ae3e287604b7..f0569263622c 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -840,6 +840,23 @@ static void ploop_advance_discarded(struct ploop *ploop, struct md_page *md,
 	ploop_hole_set_bit(d_clu, ploop);
 }
 
+static void ploop_dispatch_md_waiters(struct ploop *ploop,
+				      struct llist_node *waiters)
+{
+	struct llist_node *pos, *t;
+	struct pio *pio;
+	LIST_HEAD(list);
+
+	llist_for_each_safe(pos, t, waiters) {
+		pio = list_entry((struct list_head *)pos, typeof(*pio), list);
+		INIT_LIST_HEAD(&pio->list);
+		list_add(&pio->list, &list);
+	}
+
+	if (!list_empty(&list))
+		ploop_dispatch_pios(ploop, NULL, &list);
+}
+
 /*
  * Apply to the local BAT copy the changes made by the pios attached
  * to @piwb, whatever type @piwb was prepared with: allocations and
@@ -856,11 +873,10 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
 	struct md_page *md = piwb->md;
 	map_index_t *dst_clu;
 	unsigned long flags;
-	LIST_HEAD(list);
 	struct llist_node *wait_llist_pending;
 	struct ploop_cow *cow;
 	struct pio *pio;
-	struct llist_node *pos, *t;
+	struct llist_node *pos;
 	BUG_ON(!md);
 
 	spin_lock_irqsave(&ploop->bat_lock, flags);
@@ -893,17 +909,7 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
 	spin_unlock_irqrestore(&ploop->bat_lock, flags);
 	kunmap_local(dst_clu);
 
-	if (wait_llist_pending) {
-		llist_for_each_safe(pos, t, wait_llist_pending) {
-			pio = list_entry((struct list_head *)pos, typeof(*pio), list);
-			INIT_LIST_HEAD(&pio->list);
-			list_add(&pio->list, &list);
-		}
-	}
-
-	if (!list_empty(&list))
-		ploop_dispatch_pios(ploop, NULL, &list);
-
+	ploop_dispatch_md_waiters(ploop, wait_llist_pending);
 }
 
 static void ploop_free_piwb(struct ploop_index_wb *piwb)
-- 
2.53.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-09 19:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 19:06 [Devel] [PATCH hci-8.1 0/3] dm-ploop: fix writes to a read-only device hanging the host Denis V. Lunev
2026-11-09 19:06 ` Denis V. Lunev [this message]
2026-11-09 19:15   ` [Devel] [PATCH hci-8.1 1/3] dm-ploop: factor out ploop_dispatch_md_waiters() no-reply
2026-11-09 19:06 ` [Devel] [PATCH hci-8.1 2/3] dm-ploop: fix pios stuck in md->wait_llist after a failed BAT update Denis V. Lunev
2026-11-09 19:18   ` no-reply
2026-11-09 19:06 ` [Devel] [PATCH hci-8.1 3/3] dm-ploop: fail writes to a read-only device Denis V. Lunev
2026-11-09 19:19   ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261109190604.1850504-2-den@openvz.org \
    --to=den@openvz.org \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.