[Devel] [PATCH hci-8.2 8/9] dm-ploop: requeue requests when the request pool is empty

Denis V. Lunev den at openvz.org
Wed Nov 25 04:25:24 MSK 2026


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

The next commit disables the default I/O scheduler for devices that
ploop_dmcreate_stub() creates with a zero-rq table. Loading a ploop
table later keeps that scheduler setting, so the device can have more
requests in flight than the 512-entry reserve sized for mq-deadline.

If the reserve is empty and GFP_ATOMIC allocation fails,
ploop_clone_and_map() kills the request with an I/O error. Requeue it
so blk-mq retries when resources are available.

https://virtuozzo.atlassian.net/browse/VSTOR-95494
Feature: dm-ploop: ploop target driver
Signed-off-by: Denis V. Lunev <den at openvz.org>
---
 drivers/md/dm-ploop-map.c | 2 +-
 drivers/md/dm-ploop.h     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c62b414862b1..827346e037b0 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -2663,7 +2663,7 @@ int ploop_clone_and_map(struct dm_target *ti, struct request *rq,
 
 	prq = mempool_alloc(ploop->prq_pool, GFP_ATOMIC);
 	if (!prq)
-		return DM_MAPIO_KILL;
+		return DM_MAPIO_REQUEUE;
 	pio = (void *)prq + sizeof(*prq);
 
 	ploop_init_prq_and_embedded_pio(ploop, rq, prq, pio);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 093b7f9397a4..660e4d3531b8 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -164,7 +164,8 @@ struct ploop {
 	struct wait_queue_head dispatcher_wq_data;
 	struct wait_queue_head dispatcher_wq_fsync;
 	struct dm_target *ti;
-#define PLOOP_PRQ_POOL_SIZE 512 /* Twice nr_requests from blk_mq_init_sched() */
+/* Reserve to keep requests moving when slab allocations fail. */
+#define PLOOP_PRQ_POOL_SIZE 512
 	mempool_t *prq_pool;
 #define PLOOP_PIO_POOL_SIZE 512
 	mempool_t *pio_pool;
-- 
2.55.0



More information about the Devel mailing list