Question on the VFS inode structure.

T V Govind (govind@wipinfo.soft.net)
Wed, 27 Oct 1999 19:02:44 +0530 (IST)


Hi,
I'm new to linux and am currently in the process of trying to
understand the kernel source (file system code specifically). i have the
following question, the VFS inode structure has a union (shown below)
that is a union of the "private data" of all those file systems that are
currently supported on linux. Is there any specific reason why this
union is maintained within the inode structure itself. i mean the
structure is kind of not-specific to any particular file system and is
also defined as part of the VFS layer on linux.

---------------------------------------------
struct inode {
........

union {
struct pipe_inode_info pipe_i;
struct minix_inode_info minix_i;
struct ext_inode_info ext_i;
struct ext2_inode_info ext2_i;
struct hpfs_inode_info hpfs_i;
struct msdos_inode_info msdos_i;
struct umsdos_inode_info umsdos_i;
struct iso_inode_info isofs_i;
struct nfs_inode_info nfs_i;
struct xiafs_inode_info xiafs_i;
struct sysv_inode_info sysv_i;
struct affs_inode_info affs_i;
struct ufs_inode_info ufs_i;
struct socket socket_i;
void *generic_ip;
} u;

}
---------------------------------------------

Being thus generic why is the file system specific data kept within
this structure ?? Would it not be better to instead keep a pointer in
the inode structure, that is made to point to file system specific data
by respective file systems when a VFS inode is initialized for a file
system object (on a initial lookup of a file for example).

Possibly that way the size of the VFS inode structure would be less
(and consequently less space used overall by any VFS inodes allocated
in the system) than what it is today and file system specific inode data
would be created and destroyed as needed by individual file systems. It
also avoids having to update the VFS inode structure each time a new
filesystem is supported on linux.

Any clarification on the above will be most helpful. Please reply to
this email as i'm not subscribed to this list.

Govindan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/