From 0702e33bcfadf0abd9ccbaa8b681a19a84c332fe Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 23 Oct 2026 03:17:36 -0300 Subject: fs: keep parked write bytes outside the slot Slot carried its park room as an undefined array, so every slot reset and claim (initIn's @splat, a park, a flush) rewrote it: safe builds fill undefined, which made each connection's start touch all of its slots' room, 8 MiB at the default capacity. The room is now its own array on the engine, indexed by slot, written only by the copy of a parked write. Co-Authored-By: Claude Opus 5.5 --- src/fs.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fs.zig b/src/fs.zig index 7db6d08..d9fe2d1 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -423,6 +423,11 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { fids: [opts.fid_capacity]Fid = @splat(.{}), slots: [opts.slot_capacity]Slot = @splat(.{}), + /// A parked write's bytes, by slot. Outside `Slot` so that resetting + /// or claiming a slot never writes its room: a safe build fills an + /// `undefined` field, which made every connection's start touch all + /// of it (8 MiB at the default capacity). + slot_data: [opts.slot_capacity][park_data_max]u8 = undefined, job: Job = .{}, seq: u64 = 0, /// Fids held, orphans owed a release included. @@ -480,7 +485,6 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { fid: u32 = 0, count: u32 = 0, req: Backend.Req = undefined, - data: [park_data_max]u8 = undefined, /// What a parked open needs to become a job again; a parked /// wstat is always a truncation to zero, and a clunk or remove /// keeps nothing but its fid. @@ -1559,9 +1563,9 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { s.finishJob(); return; } - @memcpy(sl.data[0..j.req.data.len], j.req.data); + @memcpy(s.slot_data[i][0..j.req.data.len], j.req.data); sl.copied = true; - sl.req.data = sl.data[0..j.req.data.len]; + sl.req.data = s.slot_data[i][0..j.req.data.len]; } s.finishJob(); } -- cgit v1.3