Question about address space

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

 



Please clarify my doubts about address spaces of files:

The first two statements of that function in mm/filemap.c are shown
below:
void __do_generic_file_read(struct file * filp, loff_t *ppos,
read_descriptor_t * desc, read_actor_t actor, int nonblock) {
        struct address_space *mapping = filp->f_dentry->d_inode->i_mapping;
        struct inode *inode = mapping->host;
 ...
 ...
}
Why is the inode structure obtained from:
	filp->f_dentry->d_inode->i_mapping->host
instead of directly using:
	filp->f_dentry->d_inode
What is the difference between the two?


The above code shows that the valid address space of the corresponding
inode can be obtained using the file descriptor through:
	filp->f_dentry->d_inode->i_mapping;
Consider the case where one does not have the file's pathname in order
to do an open() to get the file pointer, filp. and has only the inode
number. If the inode structure is obtained using iget() with the inode
number, and the address space of that inode is accessed through
inode->i_mapping, will it have the correct (updated) value?


Thanks in advance,
Gina

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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