glm.c: detect 9p via statfs f_type, not the /mnt/ path prefix#340
Merged
Conversation
The slow-filesystem warning fired for any model path under /mnt/, which false-positives on native-Linux mounts (ZFS/ext4/xfs/NFS) that commonly live there. Check the actual filesystem type via statfs() against the 9p superblock magic (0x01021997) instead, so it only warns for a genuine WSL 9p mount. Linux-only (statfs); no behavior change on other platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The slow-filesystem warning at model load fires for any model path under
/mnt/:The intent is to catch WSL, where Windows drives (
/mnt/c, …) are slow 9p mounts. But/mnt/is also a perfectly normal mount point on native Linux — ZFS/ext4/xfs/NFS pools commonly live there. On such a box this is a false positive that tells users their fast local storage is slow.Repro: put the model on a native-Linux mount under
/mnt(e.g. a ZFS pool at/mnt/data) →WARNING: ... slow 9p/Windows filesystem ...even though it's fast local storage.Fix
Check the actual filesystem type via
statfs()against the 9p superblock magic (0x01021997) instead of guessing from the path. Linux-only (<sys/vfs.h>); no change on macOS/Windows. A real WSL/mnt/c(9p) still warns; native/mnt/*(ZFS0x2fc12fc1, ext40xef53, xfs, NFS…) no longer does.Test
Native-Linux box, model on a ZFS pool at
/mnt/data:WARNING: ... slow 9p/Windows filesystem ...statfs("/mnt/data").f_type == 0x2fc12fc1(ZFS) ≠0x01021997(9p). Builds clean (make glm).+13 −3, single file.