On 7/15/25 22:20, Andrey Zhadchenko wrote:
We do not increase inflight number when we chain pios, so we should
decrease inflight only after all chained pios are also completed,
e.g. pio->remaining is zero, and file is flushed if needed

I see that ploop_inc_nr_inflight and ploop_dec_nr_inflight are designed the way that only if ploop_inc_nr_inflight really happened on pio, then ploop_dec_nr_inflight on it will decrement the inflight reference.

E.g. chained splited pios should just have pio->ref_index == PLOOP_REF_INDEX_INVALID, if there was no ploop_inc_nr_inflight on them, and on "dec" nothing will happen.

So I'm not sure if this patch is really needed.


https://virtuozzo.atlassian.net/browse/VSTOR-108540
Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
---
  drivers/md/dm-ploop-map.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 7604b3c8d644..9f2e55df2904 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -214,6 +214,8 @@ static void ploop_prq_endio(struct pio *pio, void *prq_ptr,
        dm_complete_request(rq, bi_status);
  }
+static void ploop_dec_nr_inflight(struct ploop *ploop, struct pio *pio);
+
  static void ploop_wrkr_pio_endio(struct pio *pio)
  {
        ploop_endio_t endio_cb = pio->endio_cb;
@@ -223,6 +225,8 @@ static void ploop_wrkr_pio_endio(struct pio *pio)
file = ploop_top_delta(pio->ploop)->file;
        vfs_fsync(file, 1);
+
+       ploop_dec_nr_inflight(pio->ploop, pio);
        endio_cb(pio, endio_cb_data, pio->bi_status);
        if (free_on_endio) {
                ploop_free_pio(pio->ploop, pio);
@@ -245,6 +249,7 @@ static void ploop_do_pio_endio(struct pio *pio)
                return;
        }
+ ploop_dec_nr_inflight(pio->ploop, pio);
        endio_cb(pio, endio_cb_data, pio->bi_status);
if (free_on_endio)
@@ -2695,7 +2700,6 @@ static void ploop_handle_cleanup(struct ploop *ploop, 
struct pio *pio)
                ploop_discard_index_pio_end(ploop, pio);
ploop_unlink_completed_pio(ploop, pio);
-       ploop_dec_nr_inflight(ploop, pio);
  }
/*

--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.

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

Reply via email to