From 79efd33ba0964796d4dc4653b68435755b35f834 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 30 Oct 2026 00:01:29 -0300 Subject: 9p: a mount keeps its connection and sends each operation's walk, stat, open and first read or write in one flight, a new connection's version and attach before them: an operation through it is one round trip where it was six or seven (a directory, or a file of no stated length, two: 9P's only end is an empty read); a file whose stat gave its length is read ahead, its Treads 14 at a time; reads are timed by their progress, so a large remote file opens at 80 and 207 ms (1.3 MB timed out); a write refused unopened behind a truncating open that parked is sent again after it; Unmount lets the connection go; the CLI, --wait and Handover dial afresh, pipelined; reference.typ says how a session elsewhere mounts through ssh -L Co-Authored-By: Claude Opus 5.5 --- src/fs.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/fs.zig') diff --git a/src/fs.zig b/src/fs.zig index e4373bf0..4bbf09bb 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -921,7 +921,7 @@ pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { if (!std.mem.eql(u8, name, mount.name)) continue; // A peer answers on its own time, and the peer may be this very // editor: the turn goes out with the request. - return pardes.tape.site(.read_mount, p.gpa, ninep_io.Client.readLimit, .{ p.gpa, mount.dial, remote_path, path, limit }); + return pardes.tape.site(.read_mount, p.gpa, ninep_io.Client.readMount, .{ p.gpa, mount.dial, remote_path, path, limit }); } return error.FileNotFound; } @@ -1009,7 +1009,7 @@ fn writeOut(p: *pardes.Pardes, dial: ?[]const u8, path: []const u8, bytes: []con defer p.gpa.free(copy); pardes.turn.rest(); defer pardes.turn.wake(); - if (dial) |d| return ninep_io.Client.write(p.gpa, d, path, copy); + if (dial) |d| return ninep_io.Client.writeMount(p.gpa, d, path, copy); return writeFile(path, copy); } @@ -1542,6 +1542,7 @@ pub fn unmount(p: *Pardes, name: []const u8) !void { (path.len == prefix.len or path[prefix.len] == '/')) return error.MountInUse; } const removed = p.fs.mounts.orderedRemove(index); + if (comptime pardes.hosted) ninep_io.Client.forget(removed.dial); p.gpa.free(removed.name); p.gpa.free(removed.dial); return; -- cgit v1.3