You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add nlink column to fs_inode for O(1) link count lookups
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.
Where `16877` = `0o040755` (directory with rwxr-xr-x permissions)
427
438
428
-
**Note:** The `chunk_size` value can be customized at filesystem creation time but MUST NOT be changed afterward.
439
+
**Note:** The `chunk_size` value can be customized at filesystem creation time but MUST NOT be changed afterward. The root directory has `nlink=1` as it has no parent directory entry.
429
440
430
441
### Consistency Rules
431
442
@@ -633,6 +644,8 @@ Such extensions SHOULD use separate tables to maintain referential integrity.
633
644
634
645
- Added Overlay Filesystem section with `fs_whiteout` table for copy-on-write semantics
635
646
- Whiteout table includes `parent_path` column with index for efficient O(1) child lookups
647
+
- Added `nlink` column to `fs_inode` table to store link count directly
648
+
- Link count is now maintained in the inode rather than computed via COUNT(*) on `fs_dentry`
0 commit comments