To display indirect block numbers?

Manish Katiyar mkatiyar at gmail.com
Tue Mar 1 16:22:45 EST 2011


On Tue, Mar 1, 2011 at 12:18 PM, kashish bhatia <koolest77 at gmail.com> wrote:
> Hi all ,
>
> If I want to display block numbers of a file.
> For instance file size is 64KB and block size is 4KB. So the data will
> accommodate in 16 blocks.
>
> Now I accessed an array named "i_block[ ]" present in ext2_inode structure.
> This array stores the
> block numbers of a file.
>
> The first 12 blocks are direct blocks which will store 48KB data of file and
> the 13th block will be single indirect block which will store the rest of
> the data.
>
> In this way I can directly get the data of 48KB by referring first 12 direct
> blocks.
>
> My question is how can I access this 13th block to  get the remaining block
> numbers which will directly point to rest of the data.

In kernel or userspace ?

In userspace use debugfs. In kernel see the function ext3_block_to_path

-- 
Thanks -
Manish



More information about the Kernelnewbies mailing list