From: Jérémie Galarneau Date: Fri, 26 Jul 2024 21:47:36 +0000 (+0000) Subject: common: fd-tracker.cpp: iterate on lfht using lfht_iteration_adapter X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=12d800f6ba77e8081b74f9ef095dd3487ad5bd48;p=lttng-tools.git common: fd-tracker.cpp: iterate on lfht using lfht_iteration_adapter Change-Id: Ic28cf4f9a8534540f2e28dd5d69a146367280a9b Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/fd-tracker/fd-tracker.cpp b/src/common/fd-tracker/fd-tracker.cpp index 1db2c4245..5f454fe49 100644 --- a/src/common/fd-tracker/fd-tracker.cpp +++ b/src/common/fd-tracker/fd-tracker.cpp @@ -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( + *tracker->unsuspendable_fds)) { + DBG_NO_LOC(" %s [active, fd %d]", + unsuspendable_fd->name ?: "Unnamed", + unsuspendable_fd->fd); } if (!UNSUSPENDABLE_COUNT(tracker)) {