[Devel] [PATCH VZ9 v2 2/6] dm-ploop: set IOCB_DSYNC on all FUA requests

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Wed Oct 9 15:17:22 MSK 2024


When mapping request, save all flags, rather then only operation
type. Use it later to check if the request is FUA or not.
Unfortunately there is no REQ_FUA equivalent on IOCB layer, but
IOCB_DSYNC is usually translated to it, as can be seen in
__iomap_dio_rw().

https://virtuozzo.atlassian.net/browse/VSTOR-91817
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c    | 7 +++++--
 drivers/md/dm-ploop-target.c | 2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index b1534735e358..0eba5ce31643 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -133,7 +133,7 @@ static void ploop_init_prq_and_embedded_pio(struct ploop *ploop,
 		struct request *rq, struct ploop_rq *prq, struct pio *pio)
 {
 	ploop_init_prq(prq, rq);
-	ploop_init_pio(ploop, req_op(rq), pio);
+	ploop_init_pio(ploop, rq->cmd_flags, pio);
 	pio->css = prq->css;
 
 	pio->endio_cb = ploop_prq_endio;
@@ -1490,6 +1490,9 @@ static bool ploop_locate_new_cluster_and_attach_pio(struct ploop *ploop,
 	if (bat_update_prepared)
 		ploop_md_make_dirty(ploop, md);
 
+	if (pio->bi_op & REQ_FUA)
+		piwb->pio->bi_op |= REQ_FUA;
+
 	ploop_attach_end_action(pio, piwb);
 	attached = true;
 out:
@@ -1833,7 +1836,7 @@ static void ploop_submit_embedded_pio(struct ploop *ploop, struct pio *pio)
 		pio->queue_list_id = PLOOP_LIST_PREPARE;
 		worker = &ploop->worker;
 	} else {
-		WARN_ON_ONCE(pio->bi_op != REQ_OP_FLUSH);
+		WARN_ON_ONCE(!((pio->bi_op & REQ_OP_MASK) == REQ_OP_FLUSH));
 		pio->queue_list_id = PLOOP_LIST_FLUSH;
 		worker = &ploop->fsync_worker;
 	}
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 8b3b840dea66..aa578d1585a7 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -61,6 +61,8 @@ void ploop_call_rw_iter(struct file *file, loff_t pos, unsigned rw,
 	init_sync_kiocb(iocb, file);
 	iocb->ki_pos = pos;
 	iocb->ki_complete = ploop_aio_complete;
+	if (pio->bi_op & REQ_FUA)
+		iocb->ki_flags |= IOCB_DSYNC;
 
 	atomic_set(&pio->aio_ref, 2);
 
-- 
2.39.3



More information about the Devel mailing list