From: Andreas Dilger <adilger@turbolabs.com>
To: Jim Lu <jiml789@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Linux Ext2 Inode question
Date: Wed, 6 Feb 2002 00:01:13 -0700 [thread overview]
Message-ID: <20020206000113.K2928@lynx.turbolabs.com> (raw)
In-Reply-To: <F42jlQ0txV6JpoA7p590000e5a6@hotmail.com>
In-Reply-To: <F42jlQ0txV6JpoA7p590000e5a6@hotmail.com>; from jiml789@hotmail.com on Tue, Feb 05, 2002 at 08:02:29PM -0800
On Feb 05, 2002 20:02 -0800, Jim Lu wrote:
> I have a question regarding the inode number on the EXT2 filesystem. If I
> get a Inode number, is there a way I can calculate the block address (with
> respect to the filesystem) on this inode base on the inode number?
Yes. This is done in several places in the ext2 kernel sources, like
ext2_read_inode(). Note that it is not a simple calculation, because
the position of the inode table can (although generally does not) vary
on a per-group basis. On a cold cache, you would need to do 2 reads
to calculate the inode block location (superblock + group descriptor).
> Also, I remember reading somewhere that not all the EXT2 block groups have
> superblock information. So would the beginning of those block group look
> like this " group descriptor | block bitmap | inode bitmap | inode table |
> data " ? And, could someone please tell me which block groups have
> superblock info.
On a "sparse superblock" filesystem, superblock and group descriptor
backups are kept in groups 0 and those numbered 3^n, 5^n, 7^n, where
n is an integer. So, 0, 1, 3, 5, 7, 9, 15, 25, 27.
Groups that do not have backups generally will contain the block bitmap,
inode bitmap, inode table, and data. However, the actual position will
be given in the group descriptor table.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
prev parent reply other threads:[~2002-02-06 7:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-06 4:02 Jim Lu
2002-02-06 7:01 ` Andreas Dilger [this message]
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=20020206000113.K2928@lynx.turbolabs.com \
--to=adilger@turbolabs.com \
--cc=jiml789@hotmail.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®