dftracer readdir counts are far above strace getdents64 counts; this is expected, not a bug
Symptom#
In an IOR/mdtest comparison, dftracer reports many more readdir events than strace shows getdents64 syscalls (842 against 20 in one run). It looks like dftracer over-counts.
Cause#
The two tools count different things. dftracer hooks library calls, so it logs every readdir call the app makes. Each call returns one entry, and one last call returns NULL. glibc fills a roughly 32 KiB buffer with one getdents64 syscall, then serves later readdir calls from that buffer. A small directory needs only 2 syscalls: one that returns the entries and one that returns 0. glibc makes the syscall from inside libc, so no LD_PRELOAD tool sees it. The fstat inside opendir is hidden the same way.
Fix#
Do not compare readdir calls with getdents64 syscalls. Read the /* N entries */ count that plain strace already prints for each getdents64 call (-v is not needed). Expected readdir calls per directory are N entries (including . and ..) plus 1 for the end-of-directory call. Alternatively, drop readdir from the strace bar and label it as per entry, not per syscall. Do not add code to dftracer to chase the syscall count: seeing it needs ptrace, eBPF, seccomp or glibc internals, and the cost is not worth it.
Evidence#
The collaborator's table has 10 directories read, holding 812 entries. With 3 extra calls per directory, 812 + 10 x 3 = 842 matches the dftracer readdir total, and 10 x 2 = 20 matches the strace getdents64 total. The getdents64 wrapper only fires when an app calls getdents64() directly.