inotify FD may take several milliseconds to close. We measured
daemon-reload
default: (0.427 ± 0.05) s
async: (0.323 ± 0.02) s
with 5 path units out of 422 units. I.e. ~1% of units cause ~25% of
delay, hence this fix seems like low-hanging fruit on the daemon-reload
critical path.
Particular inotify slowness pointed out by @fbuihuu.
#include <sys/inotify.h>
#include <unistd.h>
+#include "async.h"
#include "bus-error.h"
#include "bus-util.h"
#include "dbus-path.h"
assert(s);
s->event_source = sd_event_source_disable_unref(s->event_source);
- s->inotify_fd = safe_close(s->inotify_fd);
+ s->inotify_fd = asynchronous_close(s->inotify_fd);
}
int path_spec_fd_event(PathSpec *s, uint32_t revents) {