You are not logged in.

#1 2006-01-02 04:07:39

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 163

Ext2 inodes

I understand that the inode has 12 direct pointers to the data blocks, but it is the 13,14 and 15 that confuse me.

13 is single indirect. How does it contain 256 addresses? How does one access these addresses?

Offline

#2 2006-01-02 04:26:25

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: Ext2 inodes

Haven't looked at EXT2 specifically, but from what I remember from my OS course:

Single Indirect is a pointer to a block containing pointers to data.  You'd read in the block that the single-indirect pointer is referring to, and each... word I guess... is an address to a data block of actual file data.  I guess the block is 256 words long, and hence contains 256 addresses.

-=edit=-

OK, did a quick google search on EXT2.  From the looks of things, addresses are longwords (4 bytes, if I recall correctly?) and 13 is single, 14 is double, and 15 is triple-indirect.

Let's assume the block size is 256*sizeof(longword) = 1024 bytes, provided my math and memory are correct.

Single indirect works like this:

Single-Indirect-Addr(13) points to a data block.  The data block is 1024 bytes, and so can store 256 longword addresses.  Each longword in the data block is a pointer to another data block - each of these contain actual file data.

Double indirect:

Double-Indirect-Addr(14) points to a data block.  Each of the 256 addresses in this data block are single-indirect addresses (and so point to a data block containing ANOTHER 256 addresses.)

Triple-indirect:

Triple-Indirect-Addr(15) points to a data block, and each of the 256 addresses in the data block is a double-indirect address.  See above.

Hope that clears things up a bit.

Offline

#3 2006-01-02 15:41:42

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 163

Re: Ext2 inodes

Yeah ok. I get it. So to find an individual address it is just a matter of manipulating the offsets. Thanks!

Offline

Board footer

Powered by FluxBB