Re: Query about ext2_alloc_inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What I meant is, I have a pointer of disk inode[raw_inode] in ext2_read_inode.
  1. void ext2_read_inode (struct inode * inode)
  2. {
  3. struct ext2_inode_info *ei = EXT2_I(inode);
  4. ino_t ino = inode->i_ino;
  5. struct buffer_head * bh;
  6. struct ext2_inode * raw_inode = ext2_get_inode(inode->i_sb, ino, &bh);
  7. int n;

On Jan 21, 2008 1:14 PM, Wang Yu <wangyuict@xxxxxxxxx> wrote:
  Hi,
  raw_inode? what do you point to? I can not find it in structure inode of 2.6.20.

  Regards!


On Jan 21, 2008 2:31 PM, Mayuresh < infinite.questions@xxxxxxxxx> wrote:
Thanks for reply Wang. I appreciate your reply to rather unexplored question.

Looks like ext2_inode_info[and hence vfs inode] is only allocated in alloc_inode[as name suggests]; it is not filled with fields of raw_inode. Filling vfs inode is done in read_inode where I have a pointer to raw_inode.


On Jan 18, 2008 9:20 AM, Wang Yu <wangyuict@xxxxxxxxx> wrote:
 Hi,

On Jan 17, 2008 9:22 PM, Mayuresh <infinite.questions@xxxxxxxxx> wrote:
Hi,

I want to use 'l_i_reserved2' field of ext2_inode for my purpose. I
need to initialise this field when a new inode is created. I traced
sys_create call and found that 'alloc_inode' from 'struct
super_operations' is called for new inode[correct me here]. But looks
like there is no way one can access raw inode[ext2_inode] from
alloc_inode.

Is it possible to initialise 'l_i_reserved2' in alloc_inode ? What
could be other way to do it ?

   ext2_inode_info is the data structure of memory inode, while ext2_inode is the data structure of disk inode. You should differentiate  them. ext2_alloc_inode is for    allocating the first type of inode, whereas ext2_get_inode may be for allocating the second type of inode.

 static struct inode *ext2_alloc_inode(struct super_block *sb)
 {
 struct ext2_inode_info *ei;
 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
 if (!ei)
 return NULL;
 #ifdef CONFIG_EXT2_FS_POSIX_ACL
 ei->i_acl = EXT2_ACL_NOT_CACHED;
 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
 #endif
 ei->vfs_inode.i_version = 1;
 }

LXR link for ext2_alloc_inode:
http://lxr.linux.no/linux/fs/ext2/super.c#L141

Thanks.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




--
National Research Center for Intelligent Computing Systems
Institute of Computing Technology, Chinese Academy of Sciences




--
National Research Center for Intelligent Computing Systems
Institute of Computing Technology, Chinese Academy of Sciences


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux