linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Simple inode question (ext2/3)
@ 2009-02-24 17:13 Felipe Franciosi
  2009-02-24 18:12 ` Felipe Franciosi
  2009-02-24 19:07 ` Theodore Tso
  0 siblings, 2 replies; 12+ messages in thread
From: Felipe Franciosi @ 2009-02-24 17:13 UTC (permalink / raw)
  To: linux-ext4

Hi there!

I've been trying to write a kernel module that is capable of locating a specific mounted filesystem (ext2/3) and dump all the inode entries that are in use. I have two questions:

1) Is it possible to know if an inode is free just by looking to its (struct ext3_inode) info or do I have to check the inode bitmap for the specific block group?

2) Does the following look correct?

--------8<--------

struct vfsmount        *mountpoint = ... // fetch this from the proper namespace
struct ext3_sb_info    *sbi = EXT3_SB(mountpoint->mnt_sb);
struct ext3_group_desc *egd;
struct ext3_inode      *ino;
struct buffer_head     *bh;
int i, j, k;

for (i=0; i<sbi->s_groups_count; i++) {
 egd = ext3_get_group_desc(mountpoint->mnt_sb, i, NULL);
 for (j=0; j<(sbi->s_inodes_per_group)/(sbi->s_inodes_per_block); j++) {
  bh = sb_getblk(mountpoint->mnt_sb, le32_to_cpu(egd->bg_inode_table+j));
  for (k=0; k<sbi->s_inodes_per_block; k++) {
   ino = (struct ext3_inode *)(bh+(k*sizeof(struct ext3_inode)));
   // dump contents of ino
   // index of ino should be: (i*(sbi->s_inodes_per_group)) + (j*(sbi->s_inodes_per_block)) + k
  }
 }
}

--------8<--------

Cheers,
Felipe


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-03-28  7:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-24 17:13 Simple inode question (ext2/3) Felipe Franciosi
2009-02-24 18:12 ` Felipe Franciosi
2009-02-24 19:07 ` Theodore Tso
2009-02-24 19:32   ` Felipe Franciosi
2009-02-24 21:05     ` Theodore Tso
2009-02-24 21:48       ` Felipe Franciosi
2009-02-25  4:06         ` Andreas Dilger
2009-02-25 10:59           ` Felipe Franciosi
2009-02-25 13:11             ` Theodore Tso
2009-02-25 14:10             ` Greg Freemyer
2009-02-25 14:38             ` Theodore Tso
2009-03-28  7:57               ` SandeepKsinha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).