freebsd-skq/lib
Alan Somers 82241ed55c Optimize telldir(3)
Currently each call to telldir() requires a malloc and adds an entry to a
linked list which must be traversed on future telldir(), seekdir(),
closedir(), and readdir() calls. Applications that call telldir() for every
directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and
closedir().

This optimization eliminates the malloc() and linked list in most cases by
packing the relevant information into a single long. On 64-bit architectures
msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation.  On
32-bit architectures msdosfs, NFS, and UFS can use the packed
representation, but ZFS and tmpfs can only use it for about the first 128
files per directory.  Memory savings is about 50 bytes per telldir(3) call.
Speedup for telldir()-heavy directory traversals is about 20-30x for one
million files per directory.

Reviewed by:	kib, mav, mckusick
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13385
2017-12-06 22:06:48 +00:00
..
atf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
clang Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the 2017-12-03 12:14:34 +00:00
csu lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
lib80211 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libalias DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libarchive lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libauditd DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbegemot DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libblacklist DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libblocksruntime DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbluetooth lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libbsdstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libbsm DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbsnmp DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbz2 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libc Optimize telldir(3) 2017-12-06 22:06:48 +00:00
libc_nonshared lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libc++ DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libc++experimental
libcalendar lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcam lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcapsicum
libcasper Introduce syslog service for Casper. 2017-11-12 08:34:25 +00:00
libclang_rt Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the 2017-12-03 12:14:34 +00:00
libcom_err DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libcompat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcompiler_rt
libcrypt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcuse DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libcxxrt Export std::get_new_handler() from libcxxrt.so 2017-11-03 12:52:59 +00:00
libdevctl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdevdctl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdevinfo lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libdevstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libdl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdpv DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdwarf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libedit DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libefivar Create a function to translate UEFI paths to unix paths 2017-12-02 07:29:19 +00:00
libelf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libelftc
libevent DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libexecinfo DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libexpat DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libfetch SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
libfigpar DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libgcc_eh DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND 2017-10-31 00:03:36 +00:00
libgcc_s DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND 2017-10-31 00:03:36 +00:00
libgeom lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libgpio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libgssapi lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libiconv_modules lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libifconfig
libipsec General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
libjail lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libkiconv lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libkvm lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libldns DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
liblzma DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmagic DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmd DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmemstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libmilter DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmp lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libmt Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the 2017-11-03 21:04:22 +00:00
libnandfs lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libnetbsd lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libnetgraph s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code. 2017-11-08 12:34:47 +00:00
libngatm DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libnv lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libopenbsd
libopie DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libpam lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpathconv Disconnect libpathconv tests since they require external perl and do not work with kyua. 2017-10-31 19:52:30 +00:00
libpcap DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libpe
libpjdlog lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpmc lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpmcstat DIRDEPS_BUILD: Connect new directories. 2017-10-31 00:04:07 +00:00
libproc Use a global extern declaration to appease gcc. 2017-12-06 17:52:01 +00:00
libprocstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libradius lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librpcsec_gss lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librpcsvc spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
librss DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
librt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librtld_db lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsbuf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libsdp lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsm
libsmb DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libsmdb
libsmutil
libsqlite3 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libstdbuf lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libstdthreads lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsysdecode Sync bsd_to_linux_errno[] table with i386 and amd64 tables in the sys directory. 2017-11-28 16:25:46 +00:00
libtacplus lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libtelnet
libthr lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libthread_db lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libucl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libufs lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libugidfw lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libulog lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libunbound DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libusb lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libusbhid lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libutil lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libvgl lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libvmmapi lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libwrap DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libxo DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
liby General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
libypclnt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libz DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libzstd Addd work around for LLVM bug 35023. 2017-11-26 16:41:30 +00:00
msun lib/msun: remove trailing whitespace from e_pow.c 2017-12-03 01:56:03 +00:00
ncurses General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
tests
Makefile Install strings unconditionally 2017-11-20 20:55:41 +00:00
Makefile.inc