fs/ext: Implement features 64-bit, metadata_csum, and metadata_csum_seed #506
Merged
dunkaist
merged 8 commits from 2026-07-17 10:25:15 +00:00
Matou1306/kolibrios:csum into main
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Influence/Text/TYPO
AI
Eolite
FS
GSoC
Good First PR
HLL
HardwareTested
IRCC
Influence/Settings
Lang/C
Lang/FASM
Pay for the code
Subsystem/API
Subsystem/Audio
Subsystem/Graphics
Subsystem/IPC and events
Subsystem/Memory
Subsystem/Network
Subsystem/Services(daemon)
Subsystem/Taskmanager
Subsystem/VFS
Subsystem/Window
This issue or PR in the Google Source of Code program
The issue is suitable to beginners
Paid task
infinity service, audio drivers, midi, speacker, audio programs
vesa, vga, framebuffer, cursors, blitter, and video drivers
pipes, signals, events, shared memory
virt and phys memory allocators, malloc and other
userspace and kernel(for example: serial) services
process, threads, run apps, scheduler
drivers from filesystem, fs api, blkdev, programs that work with the file system
windows, skins, buttons, mouse and keyboard code for windows (not the base code)
Category
Applications
Category
Drivers
Category
General
Category
Kernel
Category
Libraries
Kind
Breaking
Breaking change that won't be backward compatible
Kind
Bug
Something is not working
Kind
Build
Kind
Documentation
Documentation changes
Kind
Enhancement
Improve existing functionality
Kind
Feature
New functionality
Kind
Security
This is security issue
Kind
Testing
Issue or pull request related to testing
PR
Ready to merge
Pull request is ready for merge
PR
Conflicts
PR conflicts with main
PR
Dependent
This PR is dependent on another PR
PR
Request changes
Changes requested in pull request
PR
Review required
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: KolibriOS/kolibrios#506
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What is implemented: Reading support for all ext4 filesystems built with default features.
Implemented reading filesystems with 64 bit feature for partitions < 16TB (for standard 4kb block size)
Mount filesystems with metadata_csum / metadata_csum_seed and check csum, in case it doesn't match the mount fails.
Created new umka tests 75 and 77 and updated test 61:
t075: tests reading filesystems with 64-bit feature.
t077: tests mounting and validating checksums for partition with csum / csum and csum_seed enabled.
t061/ref.log: (tests reading ext4 directories) updated to show valid output instead of
unknown_fsWIP:
These might take a while (especially the second one) so I would suggest we make sure this works first.
710b9b077btoa3085caee7a3085caee7to89dd4d157a89dd4d157atoc9982366ecUpdate: Write support for the 3 features should be done, I removed the WIP label. As for the 16TB support, I added a check that refuses to write to partitions having high block fields. This will read the first 16TB fine given extents are not enabled. Do you suggest we refuse mounting these huge partitions altogether, or add a check for extents that will refuse to mount if they are enabled, and mount read-only to correctly read the first 16TB if they're not?
@dunkaist @Doczom @hidnplayr
@Burer I will take a look at your comments on the other PR, sorry for the delay, was focused on this one for the past days.
c9982366ecto36621636de@@ -558,4 +733,0 @@dec [ebx+BGDESCR.inodesFree]dec [ebp+EXTFS.superblock.inodesFree]push [ebx+BGDESCR.inodeBitmap]call extfsWriteDescriptorTry to replace this
with this
stdcall extfsWriteDescriptor, [ebx+BGDESCR.inodeBitmap]@@ -381,3 +462,4 @@.read_only:or [ebp+EXTFS.mountType], READ_ONLY@@:mov ax, 5Please, replace magic numbers with macros. Here and in other places.
@@ -384,0 +470,4 @@mov [ebp+EXTFS.descShift], alxor edx, edxbts edx, eaxmov [ebp+EXTFS.descSize], edxI think the code above can be written a bit shorter and with less bit manipulation instructions, approximately like this:
By the way, is SUPERBLOCK.descSize always a power of two?
@@ -387,3 +477,3 @@div [ebx+SUPERBLOCK.inodesPerGroup]inc eaxshl eax, 5mov cl, [ebp+EXTFS.descShift]movzx ecx, [...] is better than mov cl, [...]
https://stackoverflow.com/questions/47052342/understanding-partial-register-slowdowns-from-mov-instead-of-movzx-instruction
@@ -430,0 +527,4 @@jz .success; Verify superblock checksummov eax, -1Use movi instead of mov
@@ -430,0 +528,4 @@; Verify superblock checksummov eax, -1stdcall crc_32, 0x82F63B78, ebx, 1020Magic numbers
@@ -456,17 +583,54 @@ extfsReadBlock:@@:retmacro calc_bitmap_csum field, count {Please, make this a function
@@ -461,0 +611,4 @@sub eax, [ebp+EXTFS.descriptorTable]mov ecx, [ebp+EXTFS.descSize]xor edx, edxdiv ecxWhen you calculated descShift above, you used BSF instruction. This implies descSize is a power of two. If it is a power of two, then you can use a shift instruction instead of this DIV.
@@ -467,3 +630,3 @@shl ebx, 9add ebx, [ebp+EXTFS.descriptorTable]call fs_write32_sysmov ecx, 1You can use the movi macro when a number fits into a signed one-byte value. In that case movi is a bit shorter than mov.
@@ -488,2 +656,2 @@add [ebx+BGDESCR.blocksFree], cxadd [ebp+EXTFS.superblock.blocksFree], ecxadd [ebx+BGDESCR.blocksFree_lo], cxadd [ebp+EXTFS.superblock.blocksFree_lo], ecxWhat about .blocksFree_hi?
Those are part of the 16 Tb issue, the whole driver ignores them for now and it's the same the reason we refuse mounting partitions with hi block fields.
@@ -1576,6 +1818,35 @@ extfsTruncateFile:.ret:retmacro calc_dirblock_csum dir_ino_reg {Convert this into a function, please
6c6686a916to454540724c@dunkaist All changes should be there now, regarding the macros I replaced them with functions with labels instead of
procbecause ebp is being constantly used if that's ok?Also I kept one macro
load_bgd_64, this one is currently only used once but it will be very helpful in the future when 64 bit math gets added.Please let me know about anything else
@@ -580,2 +784,4 @@add eax, edimov ecx, eaxtest [ebp+EXTFS.superblock.RO_compatibleFlags], 0x0410is there a way to replace this set of flags with constants?
@Doczom I could do
Please let me know if that's ok.
795bb16b99to07009034370700903437to9ae27bdffb