When mapping request, save all flags, rather then only operation
type. Use it later to check if the request is FUA or not. Flush
bat only on FUA operations.

https://virtuozzo.atlassian.net/browse/VSTOR-91817
Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 10 +++++++---
 drivers/md/dm-ploop.h     |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 0809867ebd3a..bd4980259b84 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -67,6 +67,7 @@ void ploop_index_wb_init(struct ploop_index_wb *piwb, struct 
ploop *ploop)
        piwb->completed = false;
        piwb->page_id = PAGE_NR_NONE;
        piwb->type = PIWB_TYPE_ALLOC;
+       piwb->is_fua = false;
 }
 
 void ploop_init_pio(struct ploop *ploop, unsigned int bi_op, struct pio *pio)
@@ -133,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;
@@ -1489,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->is_fua = true;
+
        ploop_attach_end_action(pio, piwb);
        attached = true;
 out:
@@ -1573,7 +1577,7 @@ static void ploop_md_write_endio(struct pio *pio, void 
*piwb_ptr,
        struct ploop_index_wb *piwb = piwb_ptr;
        struct ploop *ploop = piwb->ploop;
 
-       if (bi_status) {
+       if (bi_status || !piwb->is_fua) {
                ploop_md_fsync_endio(pio, piwb, bi_status);
        } else {
                ploop_init_pio(ploop, REQ_OP_FLUSH, pio);
@@ -1858,7 +1862,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_FLUSH));
                pio->queue_list_id = PLOOP_LIST_FLUSH;
                worker = &ploop->fsync_worker;
        }
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index e693d0ed7fe4..dcdd3e47535c 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -108,6 +108,7 @@ struct ploop_index_wb {
        blk_status_t bi_status;
        u32 page_id;
        struct bio_vec aux_bvec;
+       bool is_fua;
 };
 
 /* Metadata page */
-- 
2.39.3

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

Reply via email to