Hello again
In my ext2 implementation, I assume block group descriptor table is 1 block. Is that always correct? I'm not sure it is correct, because with the size of block group descriptor is 32 bytes, and with 1024 bytes of block size, a block can have only 32 block group descriptors. (1024 / 32 = 32) With 1024 bytes of block size, a block group descriptor can only handle 8 megabytes. With 32 block group descriptors, entire ext2 can handle only 256 megabytes. (8 * 32 = 256)
But I'm still not sure
In wiki.osdev.org/Ext2 it says we can find block group count with "Rounding up the total number of blocks divided by the number of blocks per block group".
If I round block group count to (block size in bytes / 32), can I found size of block group descriptor table in blocks?
If not, how can I?
Thanks
Ext2 size of block group descriptor table
Ext2 size of block group descriptor table
Last edited by Agola on Mon Dec 19, 2016 1:18 pm, edited 1 time in total.
Keyboard not found!
Press F1 to run setup.
Press F2 to continue.
Press F1 to run setup.
Press F2 to continue.
Re: Ext2 size of block group descriptor table
If you read the documentation ( http://www.nongnu.org/ext2-doc/ext2.html ) it explains that the table can be one or more blocks in size. That document should answer all your questions.
- crunch
- Member
- Posts: 81
- Joined: Wed Aug 31, 2016 9:53 pm
- Libera.chat IRC: crunch
- Location: San Diego, CA
Re: Ext2 size of block group descriptor table
You need to calculate how many blocks the block group descriptors occupy
Code: Select all
num_to_read = ((num_block_groups * sizeof(struct ext2_group_desc)) / blocksize) + 1;
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Re: Ext2 size of block group descriptor table
Oh, that was my bad. I didn't read it, but I only read the disk organization and assumed it is only one block. ("1 block - block group descriptor table" from Chapter 3, Table 3-2. Sample 20mb Partition Layout)iansjack wrote:If you read the documentation ( http://www.nongnu.org/ext2-doc/ext2.html ) it explains that the table can be one or more blocks in size. That document should answer all your questions.
Thanks
Last edited by Agola on Mon Dec 19, 2016 1:27 pm, edited 1 time in total.
Keyboard not found!
Press F1 to run setup.
Press F2 to continue.
Press F1 to run setup.
Press F2 to continue.
Re: Ext2 size of block group descriptor table
Thanks, that works, but it reads a block more.crunch wrote:You need to calculate how many blocks the block group descriptors occupy
Code: Select all
num_to_read = ((num_block_groups * sizeof(struct ext2_group_desc)) / blocksize) + 1;
With 32 block groups, and 32 bytes (size of group descriptor) (1024 / 1024) + 1 equals 2
I think the correct one is
Code: Select all
num_to_read = ((num_block_groups * sizeof(struct ext2_group_desc)) - 1) / blocksize) + 1
Thanks
Keyboard not found!
Press F1 to run setup.
Press F2 to continue.
Press F1 to run setup.
Press F2 to continue.
- crunch
- Member
- Posts: 81
- Joined: Wed Aug 31, 2016 9:53 pm
- Libera.chat IRC: crunch
- Location: San Diego, CA
Re: Ext2 size of block group descriptor table
I was just trying to see if you were paying attention
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C