Madhu <enom…@meer.net> wrote:
>
> * tfb <11ee…@dont-email.me> :
> Wrote on Sat, 28 Nov 2026 12:51:17 -0000 (UTC):
>> Alexander Schreiber <a…@usenet.thangorodrim.de> wrote:
>>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>>> on details). All because the inode on ext4 by default is an absolutely massive
>>> 256 bytes. And that assumes fully cold caches.
>> Right. And *you're about to read the inode anyway* since you're about to
>> read the file. So the marginal cost of stat() is utterly negligible. Oh,
>> and by the way, to get to the point where you can call lseek() *you've also
>> read the inode*!
>
> I haven't had problems since I got nvme, but my earlier laptop I had a 1
> TB 3.5' "Western Digital Black (SMR)" stat times were an issue and I had
> to patch programs that eagerly `stat'ed stuff.
SMR is the problem here. Specifically, device-managed SMR where the host
OS is not aware of the cheerfully-breaking-various-assumptions hilarity
going on on the other side of the disk interface.
> zsh startup on a cold cache takes 15 seconds (.2 sec on a mirror "zfs
> filesystem" with nvme) and directories with say 40,000 files take
> minutes to dired. tracing performace at the syscall level didn't show
> anything, i suspect it's some firmware black magic that's delaying
> things which I don't know how to measure
I suspect a big part here might be implicit writes caused by reads
(atime updates) - those normally tiny (one block) writes would be
massively amplified inside the drive due to the need to rewrite an
entire block (with sizes of e.g. 256M) due to the device-managed SMR.
And since the implicit writes are triggered by the kernel (well, FS
driver) and the write amplification happens inside the drive, all you'd
see at the syscall border are some weird massive latency spikes.
Device-managed SMR is just bad. Host-managed SMR however is fine when
used with a suitable storage system (e.g. the drive is backing storage
for HDFS with 256M block size).
Kind regards,
Alex.
--
"Opportunity is missed by most people because it is dressed in overalls and
looks like work." -- Thomas A. Edison