Next Internals of ext2fs 20

Directories

     void ext2_read_inode (struct inode * inode)
     {
        ...
        block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
        ...
        group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(inode->i_sb);
        desc = block_group & (EXT2_DESC_PER_BLOCK(inode->i_sb) - 1);
        bh = inode->i_sb->u.ext2_sb.s_group_desc[group_desc];
        ...
        gdp = (struct ext2_group_desc *) bh->b_data;
        ...
        offset = ((inode->i_ino - 1) % EXT2_INODES_PER_GROUP(inode->i_sb)) *
                EXT2_INODE_SIZE(inode->i_sb);
        block = le32_to_cpu(gdp[desc].bg_inode_table) +
                (offset >> EXT2_BLOCK_SIZE_BITS(inode->i_sb));
        if (!(bh = bread (inode->i_dev, block, inode->i_sb->s_blocksize))) {
                ext2_error (inode->i_sb, "ext2_read_inode",
        ...
      }  


Next Copyright © 2001 M. J. Dominus