3 ms·
Not that it counters any point you're making, but ZFS displays the number of contained entries of a directory in the directory's size field; mind that . and ..
by chungy 24d ago
Not that it counters any point you're making, but ZFS displays the number of contained entries of a directory in the directory's size field; mind that . and .. are included, so you usually need to subtract 2 to get the count you actually want. I do find it useful sometimes to know the count without getting the listing; the former is a very inexpensive operation (since ZFS is keeping track of metadata like you suggested), the latter is expensive, potentially extremely with hundreds of thousands or more of entries.
This is more-or-less unique to ZFS. Other file systems even on Linux and FreeBSD generally don't provide this behavior.
- wongarsu 24d agoZFS being a copy-on-write fs probably made the relative cost of that feature much cheaper