[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About generic_file_read()
On Fri, 2006-01-06 at 22:34 +0530, prasad Musale wrote:
> Hello ,
> Generic_file_read() reads from cached pages. That means the file
> pages r already in page cache. But if I want to read file from disk,
> How these pages comes in page cache. Ext2 & vfat call this
> generic_file_read() as their read operation. I analyzed the sys_read()
> code but didn't get how file is read from disk. Can anyone tell me
> about that?
> Thanks.
For normal cases of read, generic_file_read() eventually calls
do_generic_mapping_read(). It first attempts to read from the cache -
this is logical. So you can see that if it finds the page and it is up
to date, it is done. Otherwise, it calls the readpage function pointer
(mapping->a_ops->readpage). This is a function that a file system
implements to read a page from disk. Since you mentioned ext2, you can
look at ext2's readpage method, called ext2_readpage(), to see how
exactly the page is read from disk.
Hope that is enough detail to get you started.
Avishay Traeger
http://www.fsl.cs.sunysb.edu/~avishay/
>
>
> From,
> Prasad
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/