fd-tracker: remove unneeded header inclusion
[lttng-tools.git] / src / common / fd-tracker / fd-tracker.c
index fbf46ec18193ecbbc1a39af6ae400e9a21c538cd..cdc1691f61da4c124032d0fe56384a7efdfeff7d 100644 (file)
@@ -15,7 +15,6 @@
  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <urcu/ref.h>
 #include <urcu.h>
 #include <urcu/list.h>
 #include <urcu/rculfhash.h>
@@ -365,6 +364,8 @@ struct fd_tracker *fd_tracker_create(unsigned int capacity)
        tracker->capacity = capacity;
        tracker->unsuspendable_fds = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
                        CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       DBG("File descriptor tracker created with a limit of %u simultaneously-opened FDs",
+                       capacity);
 end:
        return tracker;
 }
@@ -752,6 +753,17 @@ int fs_handle_get_fd(struct fs_handle *handle)
 {
        int ret;
 
+       /*
+        * TODO This should be optimized as it is a fairly hot path.
+        * The fd-tracker's lock should only be taken when a fs_handle is
+        * restored (slow path). On the fast path (fs_handle is active),
+        * the only effect on the fd_tracker is marking the handle as the
+        * most recently used. Currently, it is done by a call to the
+        * track/untrack helpers, but it should be done atomically.
+        *
+        * Note that the lock's nesting order must still be respected here.
+        * The handle's lock nests inside the tracker's lock.
+        */
        pthread_mutex_lock(&handle->tracker->lock);
        pthread_mutex_lock(&handle->lock);
        assert(!handle->in_use);
This page took 0.0254180000000001 seconds and 5 git commands to generate.