common: fd-tracker.cpp: iterate on lfht using lfht_iteration_adapter
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 Jul 2024 21:47:36 +0000 (21:47 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 18:26:44 +0000 (14:26 -0400)
Change-Id: Ic28cf4f9a8534540f2e28dd5d69a146367280a9b
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/fd-tracker/fd-tracker.cpp

index 1db2c4245af8184ce681e6d53b62344fc1ec2a7f..5f454fe4918f9afd65f9cab7b36f51333f401175 100644 (file)
@@ -397,8 +397,6 @@ error:
 void fd_tracker_log(struct fd_tracker *tracker)
 {
        struct fs_handle_tracked *handle;
-       struct unsuspendable_fd *unsuspendable_fd;
-       struct cds_lfht_iter iter;
 
        pthread_mutex_lock(&tracker->lock);
        DBG_NO_LOC("File descriptor tracker");
@@ -426,15 +424,14 @@ void fd_tracker_log(struct fd_tracker *tracker)
 
        DBG_NO_LOC("  Tracked unsuspendable file descriptors");
 
-       {
-               const lttng::urcu::read_lock_guard read_lock;
-
-               cds_lfht_for_each_entry (
-                       tracker->unsuspendable_fds, &iter, unsuspendable_fd, tracker_node) {
-                       DBG_NO_LOC("    %s [active, fd %d]",
-                                  unsuspendable_fd->name ?: "Unnamed",
-                                  unsuspendable_fd->fd);
-               }
+       for (auto *unsuspendable_fd :
+            lttng::urcu::lfht_iteration_adapter<struct unsuspendable_fd,
+                                                decltype(unsuspendable_fd::tracker_node),
+                                                &unsuspendable_fd::tracker_node>(
+                    *tracker->unsuspendable_fds)) {
+               DBG_NO_LOC("    %s [active, fd %d]",
+                          unsuspendable_fd->name ?: "Unnamed",
+                          unsuspendable_fd->fd);
        }
 
        if (!UNSUSPENDABLE_COUNT(tracker)) {
This page took 0.026315 seconds and 4 git commands to generate.