How to read an inode table from an ext2 block group?
In writing an ext2 driver for my hobby OS, I ran into a problem reading the inode table from a block group descriptor.
The third field of the block group descriptor is the block ID of the inode table for that group. In my case for the root directory of my file system this comes back as 64. The superblock is located at block 1, which is 1024 bytes past the beginning of the volume. The block size is 1024 bytes, but my disk sector size is 512. So to access the superblock, I read from lba 2.
The problem is when I try to read the inode table. If it's block id is 64, and my block size is 1024 and d开发者_运维百科isk sector size is 512, wouldn't I read the inode table from disk sector 130? I do that, but nothing is there...
What is the proper way to read an inode table given a valid block group descriptor?
The block IDs in the block group descriptor table are all absolute, so block ID 64 is going to be stored at LBA 128 and 129 in your case.
精彩评论