nerd2 / gexto

EXT2/EXT3/EXT4 Filesystem library for Golang
Apache License 2.0
40 stars 14 forks source link

Support 256 inode size #1

Open luxas opened 5 years ago

luxas commented 5 years ago

Hi,

Thanks for this great library! How easy/hard would it be to start supporting 256 inode size instead of only 128? That'd be awesome to have

Cheers!

ayushr2 commented 5 years ago

I think the library does have support for 256 inode size. What makes you say it does not?

Ext2/3 had 128 inode size but ext4 introduced the new inode struct which is 156 bytes. Ext4 inode records are 256 bytes and that is determined when the filesystem is created. The extra gap (256 - 156 = 100 bytes) in the inode records can be used to store extended attributes. This doc explains this pretty well.

ayushr2 commented 5 years ago

So if you look at this line, int64(fs.sb.Inode_size) over here would resolve to 256 IF the filesystem being used in ext4. ext2/3 only support 128 sized inodes.