Files
scriptc/tests
Chris Tate 1acdda7328 Read and write cached regular files on the loop thread in fs streams
On Linux, an fs stream's read or write of a regular file first tries
preadv2/pwritev2 with RWF_NOWAIT on the loop thread. When the page cache
holds the data, the step completes there and its completion waits for the
next loop turn (scr_work_submit_done), as a pool job's completion does,
so timers and I/O still run between steps. EAGAIN, a kernel or file
system without RWF_NOWAIT, and other files take the pool as before.

- A read the cache holds only part of finishes on the pool, so each chunk
  is the one a single read() returns.
- A partial write completes with the bytes written; the stream submits
  the rest, as after any partial write.
- Writes stay on the pool when RLIMIT_FSIZE is finite, so SIGXFSZ cannot
  reach the loop thread.

scr_work_submit_done queues a completed job on a list the loop moves to
the done queue at its next sleep step, which is skipped while jobs wait.

Corpus 8530 covers a positioned read with a small highWaterMark, a write
stream with a start position into an existing file, and an append stream
over cached files, against Node.
2026-10-29 06:33:43 -05:00
..
…