Skip to content

Conversation

@penberg
Copy link
Collaborator

@penberg penberg commented Dec 20, 2025

Previously, the link count was computed on-demand via:

  SELECT COUNT(*) FROM fs_dentry WHERE ino = ?

This query becomes expensive as the number of directory entries grows.
By storing nlink directly in the inode, we get O(1) lookups.

@penberg penberg force-pushed the optimize-nlink branch 2 times, most recently from 21793cb to d13ad1e Compare December 22, 2025 12:58
@penberg penberg changed the title sdk/rust: Store nlink in fs_inode to eliminate O(N²) readdir_plus query Add nlink column to fs_inode for O(1) link count lookups Dec 22, 2025
@penberg penberg marked this pull request as ready for review December 22, 2025 12:59
Previously, the link count was computed on-demand via:
  SELECT COUNT(*) FROM fs_dentry WHERE ino = ?

This query becomes expensive as the number of directory entries grows.
By storing nlink directly in the inode, we get O(1) lookups.
@penberg penberg merged commit 326d1be into main Dec 22, 2025
48 of 59 checks passed
@penberg penberg deleted the optimize-nlink branch December 22, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants