Re: [PATCH v1 18/20] node_device_udev: Make the code easier to read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>

On 4/19/24 16:49, Marc Hartmayer wrote:
There is only one case where force is true, therefore let's inline that case.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
---
  src/node_device/node_device_udev.c | 25 +++++++++++--------------
  1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 25571ebf708f..0b255952a9f9 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -2202,21 +2202,14 @@ mdevctlEnableMonitor(udevEventData *priv)
/* Schedules an mdevctl update for 100ms in the future, canceling any existing
   * timeout that may have been set. In this way, multiple update requests in
- * quick succession can be collapsed into a single update. if @force is true,
- * the worker job is submitted immediately. */
+ * quick succession can be collapsed into a single update. */
  static void
-scheduleMdevctlUpdate(udevEventData *data,
-                      bool force)
+scheduleMdevctlUpdate(udevEventData *data)
  {
-    if (!force) {
-        if (data->mdevctlTimeout != -1)
-            virEventRemoveTimeout(data->mdevctlTimeout);
-        data->mdevctlTimeout = virEventAddTimeout(100, submitMdevctlUpdate,
-                                                  data, NULL);
-        return;
-    }
-
-    submitMdevctlUpdate(-1, data);
+    if (data->mdevctlTimeout != -1)
+        virEventRemoveTimeout(data->mdevctlTimeout);
+    data->mdevctlTimeout = virEventAddTimeout(100, submitMdevctlUpdate,
+                                              data, NULL);
  }
@@ -2251,7 +2244,11 @@ mdevctlEventHandleCallback(GFileMonitor *monitor G_GNUC_UNUSED,
       * CHANGES_DONE_HINT event. As a fallback,  add a timeout to trigger the
       * signal if that event never comes */
      VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-        scheduleMdevctlUpdate(priv, (event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT));
+        if (event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
+            submitMdevctlUpdate(-1, priv);
+        } else {
+            scheduleMdevctlUpdate(priv);
+        }
      }
  }

--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux