Repository navigation
Conversation
|
@Alyx-ML checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
flush_interval defaulted to 1000 ms. Within that window apple_nvme_queue_rq() completed a REQ_OP_FLUSH at once and sent one flush to the drive when the window ended. The filesystem was told the data was durable while it was still in the drive's cache, so a power loss or a crash in that window lost data that fsync() had reported as safe. Post-M4 controllers were already exempt; every earlier ANS (the t8015 and t8103 profiles, which the generic apple,nvme-ans2 compatible also selects for T600x and T8112) ran with the deferral on. Make 0 the default, so every flush reaches the drive before it completes. Keep the parameter for people who accept the risk, and say in its description that a non-zero value acknowledges flushes before they reach the drive. Make the variable static: it was a global symbol named flush_interval. This trades flush latency for durability on M1, M2 and M3 machines. The cost has not been measured: fio numbers on M1, M2 and M3 are needed before this is merged. Checked with a host harness built from the real apple_nvme_delayed_flush() text under ASan and UBSan: with the old default, 99 of 100 flushes sent 10 jiffies apart were completed early; with the new default none are, and an opt-in interval behaves as before. Not built as a kernel module here, and not run on hardware. Signed-off-by: Alyx-ML <[email protected]>
T6040 (M4 Pro) is the T8132 controller with a different register layout, as the comment above its profile says. T8132 sets NVME_QUIRK_BROKEN_FUA because writes were lost across a reset on J713 unless they were flushed. T6040 did not set it, so it trusted FUA on the same controller. Name the T8132 quirk set once and use it in both profiles, so T6040 follows the J713 result instead of a copied list that can drift. The block layer then follows each FUA write with a flush on T6040. At worst this costs one extra flush per FUA write; it cannot lose data that FUA alone would have kept. The evidence is the J713 (T8132) result. It has not been repeated on T6040: an M4 Pro run (an fsynced FUA write across an abrupt reset, and fio before and after) is needed before this is merged. Signed-off-by: Alyx-ML <[email protected]>
|
Rebased onto The build link in the description is from the old base. My fork's Actions could not run this Assisted-by: LLM (Claude:Opus 5.5) |
0621648 to
3001857
Compare
|
M2 data for this PR: MacBook Air J413 (T8112), internal ANS, Test. A raw 256 MiB window on the internal disk, outside any filesystem, written with O_DIRECT.
Cost. About 0.8 ms per real flush, roughly 25× fewer fsyncs per second for an fsync-bound loop on this machine. That is what A filesystem that writes its superblock after a flush it was told completed can be left referencing blocks that never reached the disk. That matches the btrfs damage seen after repeated resets on a T8122 machine. I'd support taking this PR. I haven't run the T6040 quirk change; I have no hardware for it. |
|
Row at this PR's head (both commits, unchanged) on the M2 MacBook Air J413, default command line, no
So the M2 part of the evidence list is done at the PR head. The T6040 quirk change isn't covered; I have no such machine. |
Part of the #2755 split. Draft: it needs numbers I cannot measure (no Mac here).
Summary
Evidence
acked before reaching the drive, and with the new default none are.
and one M3 machine, and an M4 Pro row (an fsynced FUA write across an abrupt reset, and FUA
write throughput).
Merge Danger
Door: two-way
Blast Radius: storage performance
Slower flushes on M1/M2/M3 and slower FUA writes on M4 Pro, in exchange for fsync() meaning what it
says.
flush_interval=1000restores the old behaviour.