Backport: fd-tracker: add an optimization note to the fd-tracker
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 6 Jul 2018 02:43:33 +0000 (22:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 6 Jul 2018 23:17:24 +0000 (19:17 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/fd-tracker/fd-tracker.c

index 2f743be942ed40be2e5f4e1bc80f7948f1a66567..e26ff2185f2f9ebe48a4a764299aa74e429401d9 100644 (file)
@@ -754,6 +754,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.028779 seconds and 5 git commands to generate.