ext2 clarification

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

ext2 clarification

Post by sancho1980 »

Hi

In the ext2 wiki (http://wiki.osdev.org/Ext2), I found the following:
Locating the Block Group Descriptor Table
The table is located in the block immediately following the Superblock. So if the block size (determined from a field in the superblock) is 1024 bytes per block, the Block Group Descriptor Table will begin at block 2.
How does that make sense? If the superblock is 1024 bytes and the block descriptor table "is located in the block immediately following the Superblock", then I'd say it must begin at block 1, no??
The it goes on to say:
For any other block size, it will begin at block 1. Remember that blocks are numbered starting at 0, and that block numbers don't usually correspond to physical block addresses.
So even if the block size was 512 bytes, it would start at block 1, i.e. in the middle of the superblock (which with its 1024 bytes would occupy 2 blocks)???
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: ext2 clarification

Post by piranha »

How does that make sense? If the superblock is 1024 bytes and the block descriptor table "is located in the block immediately following the Superblock", then I'd say it must begin at block 1, no??
The superblock starts at an offset of 1024 bytes. If the block size is 1024 then it starts at block 1.

As for your second question, I believe it works like this:

You can only have block sizes of 1024, 2048, 4096, etc. Therefore, since the superblock starts at 1024 bytes in, any other block size than 1024 will result in the superblock ending before the start of the next block, block 1. The super block is then contained in block 0, from bytes 1024 to 2048. You cant have 512 sized blocks.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Post Reply