Question about __do_generic_file_read() in 2.4 source

From: Gina (s_sitaraman_at_hotmail.com)
Date: 08/26/04

  • Next message: Måns Rullgård: "Re: Persistent System Memory"
    Date: 26 Aug 2004 14:32:45 -0700
    
    

    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;

    I do not have the file's pathname in order to do an open() to get the
    file pointer, filp. I have the inode number only. If I obtain the
    inode structure using iget() with the inode number, and access the
    address space of that inode through inode->i_mapping, will it have the
    correct (updated) value?

    Thanks in advance,

    Gina


  • Next message: Måns Rullgård: "Re: Persistent System Memory"

    Relevant Pages