Skip to content

Add deep extent tree support (depth >= 2) in EXT4 formatter#650

Open
gbfish wants to merge 1 commit intoapple:mainfrom
gbfish:deep-extents-formatter
Open

Add deep extent tree support (depth >= 2) in EXT4 formatter#650
gbfish wants to merge 1 commit intoapple:mainfrom
gbfish:deep-extents-formatter

Conversation

@gbfish
Copy link
Copy Markdown

@gbfish gbfish commented Apr 4, 2026

Summary

  • Reader: Refactor getExtents() with recursive readExtentNode() that handles any depth
  • Formatter: Extract writeExtentSubtree() that recursively builds extent trees of any depth
  • Fix force-unwrap crash on leafNode.leaves.last!.block (use safe optional access)
  • Replace hardcoded depth 0/1 switch with general depth calculation
  • Consistent use of .loadLittleEndian(as:) for all on-disk struct reads
  • Add test for multi-extent file readback

@dcantah
Copy link
Copy Markdown
Member

dcantah commented Apr 6, 2026

Thanks for the work. To me, would you be open to merging the two changes into one? It'd be simpler to look for logical bugs if the formatter and reader are all in one.

@gbfish
Copy link
Copy Markdown
Author

gbfish commented Apr 6, 2026

Done — combined both reader and formatter changes into this single PR. Thanks for the suggestion.

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.

3 participants