OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 10:59 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Error In EXT2 Documentation
PostPosted: Wed May 02, 2012 4:20 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
http://wiki.osdev.org/Ext2

The original text stated that if the blockSize is 1024 that the first group block descriptor will start at the 2nd block (zero indexed) or aka 2048, and if the bockSize was other than 1024 the first group block descriptor will start at the 1st block (zero indexed).

Of course this did not make a lot of sense, but I discovered that instead (and this way makes more sense) that if the blockSize is 1024 that the first block group descriptor will start at 1024. This I actually tested and found to be true after using mkfs.ext2.

I am not sure and can not test but it maybe if the majorVersion field is >= 1 then you will have the extended super block (2048 byte superblock instead of 1024) and then it would make sense for the first group descriptor block to start at offset 2048 instead of 1024 because otherwise you would have the extended superblock (1024 bytes) and the first block group descriptor sitting on top of each other which has to be incorrect.

EDIT:
Anyway, I left a note there for future readers. To at least get them to double check if they run into problems, and hopefully if one or more people verify then we could fix it on the wiki.

EDIT:
Wait, found something funny in my own code. Maybe indeed the wiki page is correct. Let me figure out what kind of weird mistake I made.


Top
 Profile  
 
 Post subject: Re: Error In EXT2 Documentation
PostPosted: Wed May 02, 2012 6:24 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 09, 2010 8:57 am
Posts: 255
Location: Moscow, Russia
Pancakes wrote:
The original text stated that if the blockSize is 1024 that the first group block descriptor will start at the 2nd block (zero indexed) or aka 2048, and if the bockSize was other than 1024 the first group block descriptor will start at the 1st block (zero indexed).

That's all right.

Pancakes wrote:
but I discovered that instead (and this way makes more sense) that if the blockSize is 1024 that the first block group descriptor will start at 1024.

This is impossible because at 1024 there is always superblock, not BGDT. It is explicitly documented and tested. Superblock occupies 1024 bytes, that's why BGDT starts at least at position 2048.

Pancakes wrote:
I am not sure and can not test but it maybe if the majorVersion field is >= 1 then you will have the extended super block (2048 byte superblock instead of 1024)

There is no such thing as extended superblock (no matter what version is).

_________________
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.


Top
 Profile  
 
 Post subject: Re: Error In EXT2 Documentation
PostPosted: Wed May 02, 2012 10:57 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
Yeah, but it says right here:


Extended Superblock Fields
These fields are only present if Major version (specified in the base superblock fields), is greater than or equal to 1...


Even the documentation said extended super block fields.

Edit:
I just pulled a page here: http://www.science.unitn.it/~fiorella/g ... ode95.html

It seems to depict a super block before every BGDT, which is quite confusing, lol. I am going to try to make my file system use a second BGDT and then see what everything does.


Top
 Profile  
 
 Post subject: Re: Error In EXT2 Documentation
PostPosted: Wed May 02, 2012 11:33 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
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. 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.
Code:
[1] It is located in the table immediately following the superblock.
[2] if block size == 1024:
     [0]
     [1] superbock
     [2] BGDT
[3] if block size == 2048:
    [0]
    [1] superblock ... BGDT will overwrite superbock


I maybe misinterpreting (of course) what he means by block in that paragraph. It is obvious that the way it is worded can be confusing right?


Top
 Profile  
 
 Post subject: Re: Error In EXT2 Documentation
PostPosted: Wed May 02, 2012 1:50 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 09, 2010 8:57 am
Posts: 255
Location: Moscow, Russia
Pancakes wrote:
Extended Superblock Fields
These fields are only present if Major version (specified in the base superblock fields), is greater than or equal to 1...

Even the documentation said extended super block fields.

Yes. But that extended fields are located at the same 1024 bytes of superblock. Just used bytes that were free in previous versions.

Use this documentation instead: http://www.nongnu.org/ext2-doc/

Pancakes wrote:
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. For any other block size, it will begin at block 1.
Code:
[1] It is located in the table immediately following the superblock.
[2] if block size == 1024:
     [0]
     [1] superbock
     [2] BGDT
[3] if block size == 2048:
    [0]
    [1] superblock ... BGDT will overwrite superbock

No, that's wrong.
If the block size is 1024 bytes, the 0 block is free (for boot code), the 1st block is superblock, the 2nd block is BGDT.
If the block size is 2048 bytes, the superblock will locate inside the 0 block and the 1st block will be BGDT. The same for blocks larger than 2048.

_________________
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.


Top
 Profile  
 
 Post subject: Re: Error In EXT2 Documentation
PostPosted: Wed May 02, 2012 2:23 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
Ok, let me meditate on this for some time. And, thank you for taking the time to help me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group