Repository navigation
Fix symlink storage and add directory reparenting - #12
Open
flowerishere wants to merge 2 commits into
Open
flowerishere wants to merge 2 commits into
flowerishere wants to merge 2 commits into
Conversation
Use inode block accounting to distinguish fast symlinks from block-backed targets and skip block-map traversal when freeing inline targets. Store 60-byte targets in a data block and reject empty or oversized targets before allocating an inode. Validate the parent and check for existing names before creation. Reclaim unpublished inodes on initialization or target-write failures, while retaining entries already published when directory insertion reports an I/O error. Add ext2/ext4 boundary, hard-link, invalid-request, and injected-write failure coverage. Validate all eight std/sync/multi-threaded feature combinations with filesystem checks enabled.
Expose Dir::reparent(old_parent, new_parent) as a raw directory rename building block. Validate the dot records, htree layout, and destination inode before changing only the .. inode number and first-block checksum. Leave namespace moves, cycle prevention, and parent link counts to callers. Reject corrupt htree counts before checksum slicing and attempt to restore the original disk block when the update reports a write failure. Cover linear directories, htree roots at two depths, invalid layouts and requests, no-op calls, and errors before or after partial/full writes.
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.
This is a follow-up to MOSS #322 (https://github.com/hexagonal-sun/moss-kernel/pull/322). That PR needed a couple of workarounds for symlinks and moving directories, so I’m bringing the relevant fixes into ext4plus.
For symlinks, the main fix is to stop treating inline target bytes as block pointers on the last unlink. This also fixes the 60-byte boundary: targets up to 59 bytes stay inline, while longer targets use a data block.
The other part adds
Dir::reparent(old_parent, new_parent). It updates the existing..entry and its checksum without rebuilding the directory or its htree index. Moving the directory entries, updating parent link counts, and preventing cycles are still the caller’s responsibility.I also added checks around symlink creation and some error handling for failed writes, along with regression tests. Both commits passed all eight feature combinations, and the modified test images passed
e2fsck.