SchOS/kernel/fs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 09e07423e8 fs: inode and open-file tables that grow, with a hash for iget
The inode table was NINODE (200) entries, searched end to end on every
iget(), and a panic -- "iget: no inodes" -- when all of them were held.
Held means open, a cwd, a running binary or a directory mid-walk, so a
few busy processes reached it. iget() now finds an inode through a hash
on (dev, inum), takes a free one from a list, and makes more from a
slab cache once the NINODE in the image are all in use.

The open-file table had the same shape, NFILE (512) and then ENFILE,
and gets the same treatment: a free list, and the slab past NFILE.
/proc/fsstat's peaks now read against how many exist.

getrlimit(RLIMIT_NOFILE) said unlimited, which musl turns into
sysconf(_SC_OPEN_MAX) == -1, after which zsh believed it had no
descriptors and `exec {fd}<file` failed on the first one. It reports
NOFILE now. And a comment in sys_fs.c held a "*/" that ended it early.

Checked under QEMU: six processes holding 115 files each, 713 open
descriptions and 341 inodes at once, all back to the baseline after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
2026-10-23 13:39:14 +02:00
..
fat vfs: names up to 255 bytes and paths up to 4096, like Linux 2026-10-23 11:17:28 +02:00
schfs schfs: commit every 5 s, survive a full disk, mount up to 64 TiB 2026-10-23 12:20:05 +02:00
devfs.c fat: FAT12, FAT16 and FAT32 with long names, read and write 2026-10-23 09:33:35 +02:00
exec.c exec: Linux's 2 MB of arguments; mmap: merge neighbouring mappings 2026-10-23 13:20:29 +02:00
file.c fs: inode and open-file tables that grow, with a hash for iget 2026-10-23 13:39:14 +02:00
fs.c fs: inode and open-file tables that grow, with a hash for iget 2026-10-23 13:39:14 +02:00
log.c Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
pipe.c kmem: a slab allocator, and what the fixed tables actually cost 2026-09-22 09:32:06 +02:00
procfs.c fs: follow symlinks like Linux; Linux mknod; /proc/partitions 2026-10-23 10:50:41 +02:00
sysfs.c hwreport: describe a machine onto a USB stick, from a Linux-style /sys 2026-10-23 12:54:11 +02:00