Re: Read operation on Block device.

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

 



Hi,
Its wrong that generic_file_read does nothing but its
very cruicial one,its allocates the page if it's not
in the cache,means some process already read that
porrtion of file and page is there in cache other wise
it repeatedly calls readpage which is cruicial and
internal to filesystem which is what  implemented in
yr mentioned filesystem or ext2 and ext3,
whcih internally fills the buffers in page with the
data I.E content of that file and then returns to VFS
I.E generic_read_file,
Its time to action of generic_file_read which is very
cruicial it forward the f_pos to read next page full
of data as it repetedly calls readpage and the
routiene
i dont reming its name some --Actor routitne passes
this data to user space from kernel memory,
so taht process reading the contects of file get into
its buffer.
If i missed something please sorry for that.

Think VFS as generic abstract Class  with lots of pure
virtual functions .
And as FS developer yr filesystem is object of that
class which implements  all these virtual functions as
i discussed above readpage.
 
Thanks
Prasanna

--- Manu Garg <manugarg@xxxxxxxxx> wrote:

> When a special file is opened, it's file operations
> are set by
> filesystem in which the file is. Say for example if
> you have /dev/hda
> in ext3 filesystem, it's file operations will be set
> by ext3 when
> incore inode will be created (generally when file is
> opened for the
> first time). These file operation are specific to
> the file type
> (directories, link, device...etc). Now for a block
> device which
> /dev/hda is, these operations are defined in
> def_blk_fops
> (fs/block_dev.c). This structure has
> generic_file_read as it's read
> function.
> 
> generic_file_read doesn't do nothing. This function
> is used for all
> filesystems that can use page_cache directly. I
> don't understand this
> function much, so cann't explain it further.
> 
> Cheers!
> -Manu
> 
> 
> 
> 
> On Wed, 29 Sep 2004 15:23:24 +0545, manish regmi
> <regmi.manish@xxxxxxxxx> wrote:
> > Hi,
> >  Can anybody explain me how read operation on
> Block device (say ide
> > device) work.
> > The read file operations of Block device is set to
> generic_file_read,
> > i.e nothing. and the ide driver does not have read
> routine.
> > Then, How Block device driver or Ide Driver reads
> the data?
> > 
> > for eg in this type of app.
> > i = open(/dev/hda, O_RDONLY);
> > read(i ,....);
> > 
> > Thanks in advance.
> > 
> > --
> > Kernelnewbies: Help each other learn about the
> Linux kernel.
> > Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> > 
> > 
> 
> 
> 
> -- 
> ----------------
> Manu Garg
> http://manugarg.freezope.org
> 
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

--
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