The proper term to use is inode number, block number (or block ID), or inode
structure.

As far as possible, for both of these information, it is NOT saved in the
storage space.   reason is because it is supposed to be calculated.

For example - from kernel source fs/ext2/inode.c:

static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino,
                                        struct buffer_head **p)
{
        *p = NULL;
        if ((ino != EXT2_ROOT_INO && ino < EXT2_FIRST_INO(sb)) ||
            ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count))
                goto Einval;

        block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);
        gdp = ext2_get_group_desc(sb, block_group, NULL);
        if (!gdp)
                goto Egdp;
        /*
         * Figure out the offset within the block group inode table
         */
        offset = ((ino - 1) % EXT2_INODES_PER_GROUP(sb)) *
EXT2_INODE_SIZE(sb);
        block = le32_to_cpu(gdp->bg_inode_table) +
                (offset >> EXT2_BLOCK_SIZE_BITS(sb));
        if (!(bh = sb_bread(sb, block)))
                goto Eio;

        *p = bh;
        offset &= (EXT2_BLOCK_SIZE(sb) - 1);
        return (struct ext2_inode *) (bh->b_data + offset);


ie, given the inode number deduce the block number (from kernel source):

block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);

given the inode number....derive the offset ptr to the inode structure
inside the inode table.

http://www.nongnu.org/ext2-doc/ext2.html---> lookup section 3.6 for the
formula calculation.

On Tue, Mar 10, 2009 at 4:48 AM, Manish Katiyar <[email protected]> wrote:

> On Tue, Mar 10, 2009 at 1:06 PM, Sagar lokhande <[email protected]>
> wrote:
> > hi all
> > how can i find  the inode block address?
>
> [ccing kernelnewbies]
>
> What do you mean by that ? Do you mean the block numbers for a
> particular inode ??
>
> Thanks -
> Manish
>
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel"
> in
> > the body of a message to [email protected]
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to [email protected]
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>


-- 
Regards,
Peter Teoh

Reply via email to