improve how and when we wait for pios to complete
before proceeding with next pios.
force writing of pending md pages in case we have a sync pios.
remove now unused functions.

https://virtuozzo.atlassian.net/browse/VSTOR-91821
Signed-off-by: Alexander Atanasov <alexander.atana...@virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 35d12fd54050..f9904e708c35 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -2049,6 +2049,7 @@ void do_ploop_run_work(struct ploop *ploop)
        struct llist_node *llflush_pios;
        unsigned int old_flags = current->flags;
        int npios;
+       int force_md_update;
 
        current->flags |= PF_IO_THREAD|PF_LOCAL_THROTTLE|PF_MEMALLOC_NOIO;
 
@@ -2064,8 +2065,7 @@ void do_ploop_run_work(struct ploop *ploop)
                ploop_runners_add_work_list(ploop, lldeferred_pios);
 
        if (llembedded_pios)
-               ploop_prepare_embedded_pios(ploop, 
llist_reverse_order(llembedded_pios),
-                                           &deferred_pios);
+               ploop_prepare_embedded_pios(ploop, llembedded_pios, 
&deferred_pios);
 
        llflush_pios = llist_del_all(&ploop->pios[PLOOP_LIST_FLUSH]);
 
@@ -2080,23 +2080,28 @@ void do_ploop_run_work(struct ploop *ploop)
        if (llcow_pios)
                ploop_runners_add_work_list(ploop, llcow_pios);
 
-       /* wait for all pios to be executed before metadata updates */
+       /*
+        * put stick in the wheel - wait for all pios to be executed before 
doing metadata
+        * we could gain a bit more iops if we can skip this wait but for now 
we can not
+        */
        current->flags = old_flags;
-       wait_event_interruptible(ploop->dispatcher_wq_data, 
(!ploop_runners_have_pending(ploop)));
+       wait_event_interruptible(ploop->dispatcher_wq_data,
+                                (!ploop_runners_have_pending(ploop)));
        current->flags |= PF_IO_THREAD|PF_LOCAL_THROTTLE|PF_MEMALLOC_NOIO;
 
        /* if we have a flush we must sync md data too */
-       npios = ploop_submit_metadata_writeback(ploop, !!llflush_pios | 
ploop->force_md_writeback);
+       force_md_update = !!llflush_pios | ploop->force_md_writeback;
+       npios = ploop_submit_metadata_writeback(ploop, force_md_update);
 
-       if (llflush_pios) {
-               if (npios) {
-                       /* wait for metadata writeback to complete */
-                       current->flags = old_flags;
-                       /* First wait all pios to be processed */
-                       wait_event_interruptible(ploop->dispatcher_wq_data,
-                                                
(!ploop_runners_have_pending(ploop)));
-                       current->flags |= 
PF_IO_THREAD|PF_LOCAL_THROTTLE|PF_MEMALLOC_NOIO;
-               }
+       if (npios) {
+               /* wait for metadata writeback to complete */
+               current->flags = old_flags;
+               /* First wait all pios to be processed */
+               wait_event_interruptible(ploop->dispatcher_wq_data,
+                                        (!ploop_runners_have_pending(ploop)));
+               current->flags |= 
PF_IO_THREAD|PF_LOCAL_THROTTLE|PF_MEMALLOC_NOIO;
+       }
+       if (llflush_pios || npios) {
                /* Now process fsync pios after we have done all other */
                npios = process_ploop_fsync_work(ploop, llflush_pios);
                /* Since dispatcher is single thread no other work can be 
queued */
-- 
2.43.0

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

Reply via email to