[Devel] [PATCH VZ9 v3 02/13] dm-ploop: set IOCB_DSYNC on all FUA requests

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Oct 24 20:23:30 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 f2a28026b2b5..6765e67db1d9 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -134,7 +134,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;
@@ -1494,6 +1494,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:
@@ -1865,7 +1868,7 @@ static void ploop_submit_embedded_pio(struct ploop *ploop, struct pio *pio)
 	if (blk_rq_bytes(rq)) {
 		pio->queue_list_id = PLOOP_LIST_PREPARE;
 	} 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;
 	}
 
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index ea9af6b6abe9..8ee71215c6b1 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