Re: generic_file_read()

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

 



On 1/6/06, Dhaval Shirsath <dhavalrs@xxxxxxxxx> wrote:
> Hi,
>     can anybody tell about the following 2 Q's:
>
>     1] What does the generic_file_read() fn does & what is the role of
> the structure "stuct kiocb" ,what is its use?
>

generic_file_read is the generic function for file-systems which can
use page cache directly and it actually creates/initializes the
necesaary variables for performing read operation, do check for
direct_io case and so direct_io if it is set else perform normal read
operation, perform read_ahead (if required, and call readpages
function of address_space_operations related to file (assigned to
filp->mapping->a_ops by the file system at the time of file creation 
or might be in lookup) to perform the actual read from the storage and
then cached those pages and provide data in the user buffer) and if
data/page is not in cache then it calls the readpage function of the
file-system to perform actual reading from the storage. See the
generic_file_read code found in mm/filemap.c file for more detail ....
The kiocb is used to do asynchronous io (seach google for more detail)

>     2]What does the generic_file_open() fn does ?
>

generic_file_open function (what I can get by looking at the code is)
just checks for the O_LARGEFILE flags in filp->flags that it will be
set and the file size (getting it from inode) not greater than
MAX_NON_LFS (which is (1UL<<31) -1 = 2GB) then it allow by returning 0
to open the file else it simple gives error of file is big ....
(CMIIW)

--
Fawad Lateef

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