summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fs.zig10
1 files 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();
}