public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Akshay Nehe <akshaynehe785@gmail.com>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: Required help for understanding ext4 block allocation
Date: Fri, 16 Mar 2012 10:18:10 +0100	[thread overview]
Message-ID: <20120316091810.GB24821@quack.suse.cz> (raw)
In-Reply-To: <CA+tw96DSaJH50o1F4sW9XMnmPD8dFO9VCyvK4tbsLFqfgK9CWQ@mail.gmail.com>

  Hello,

On Thu 15-03-12 18:48:56, Akshay Nehe wrote:
> I am trying to understand the block allocation in ext4 file sytem, I
> have gone through all basic theory and browsing code to do it.
> 
> I am writing a module in which i got ext4 on disk inode, now according
> to theory first 12 bytes of i_block points to ext4_extent_header, so
> can i use this array of i_block[EXT4_N_BLOCKS].
> 
> Means how to fill objects of  struct ext4_extent_header (using first
> 12 byte of i_block) and  struct ext4_extent (using reminder bytes of
> i_block).
  struct ext4_extent_header is just directly stored in the space occupied
by i_block[EXT4_N_BLOCKS]. So for example ext_inode_hdr() does:
  (struct ext4_extent_header *)EXT4_I(inode)->i_data
(where i_data is just one-to-one copy of i_blocks from on disk inode).

And it's the same with struct ext4_extent. See for example macro
EXT_FIRST_EXTENT.

								Honza

-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2012-03-16  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15 13:18 Required help for understanding ext4 block allocation Akshay Nehe
2012-03-16  9:18 ` Jan Kara [this message]
2012-03-22 13:24   ` Akshay Nehe
2012-03-22 14:11     ` Jan Kara
2012-03-22 15:22       ` Akshay Nehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120316091810.GB24821@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akshaynehe785@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox