fix(hardlink)!: use (device, inode) pair as deduplication key#347
fix(hardlink)!: use (device, inode) pair as deduplication key#347
Conversation
…ross-filesystem false deduplication Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Performance Regression Reportscommit: fe98f44 There are no regressions. |
…on key Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
Yes, the device number is used. Added a dedicated test |
There was a problem hiding this comment.
Pull request overview
This PR fixes hardlink deduplication across multiple filesystems by switching the internal key from inode-only to a (device, inode) pair, preventing false merges when scanning multiple roots on different devices while keeping the public API and JSON schema unchanged.
Changes:
- Introduce an internal
InodeKey { dev, ino }and key theHardlinkListmap by it. - Thread
devthrough hardlink recording and update iterators accordingly. - Keep reflection/JSON
ino-only (with a documented limitation) and update tests to cover same-inode/different-device behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hardlink/hardlink_list.rs | Adds InodeKey and rekeys the internal DashMap; updates add() to accept dev. |
| src/hardlink/hardlink_list/iter.rs | Updates iterator key types to InodeKey; Item::ino() returns key.ino. |
| src/hardlink/hardlink_list/reflection.rs | Strips dev when producing reflection; uses dev=0 placeholder on load; updates docs. |
| src/hardlink/aware.rs | Extracts dev from metadata and passes it into HardlinkList::add(). |
| src/hardlink/hardlink_list/test.rs | Updates test table/call sites for dev and adds a cross-device same-inode test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot The following reviews:
Do you agree with these reviews? If you do, implement them. If you don't, provide a reason why you disagree and skip it. |
…TryFrom Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
All three reviews are correct and have been implemented in commit eb92bdc:
|
(device, inode)pair as deduplication keyReflectiondoc comment: inode numbers are NOT guaranteed unique (only(dev, ino)pairs are)(ino, dev)before droppingdevinFrom<HardlinkList>✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.