Re: read() system call

Stephen C. Tweedie (sct@redhat.com)
Mon, 14 Sep 1998 10:52:53 +0100


Hi,

On Fri, 11 Sep 1998 12:15:55 -0500 (CDT), Ravi Wijayaratne
<ravi@jumprun.tamu.edu> said:

> Hi ,
> I am trying to trace the function class involved with a file read through
> the ext2 file system. I figured that the disk driver access point is
> ll_rw_block in linux/drivers/block/ll_rw_blk.c. There are 3 places this
> function is called as far as the read is concerned.

> 1. block_read in linux/fs/block_dev.c
> 2. brw_page in linux/fs/buffer.c
> 3. bread in linux/fs/buffer.c

> Can some one please tell me what function is used by ext2 file system ?

None of them. ext2fs does not read files: the VFS reads them on
ext2fs's behalf, using several general-purpose functions in the page
cache management code.

Look in linux/fs/ext2/file.c. You'll see that the
"ext2_file_operations" structure defines the read entry point for ext2fs
to be "generic_file_read", which is in linux/mm/filemap.c. That
function performs its reads using the inode's readpage method, which in
ext2fs again points to a generic function, "generic_readpage" in
linux/fs/buffer.c. And _that_ works by calling the inode's "bmap"
method to find which blocks on disk correspond to the requested data,
then calling "brw_page" to do the read.

The only place in this whole sequence where ext2fs itself gets involved
is in the bmap code, where the filesystem needs to look up its on-disk
structures to find where the requested data is located.

> If you can give me information as to how I could track this down inside
> the kernel and file system I will be very grateful.

Follow the function calls through from sys_read(), and in particular
look at the filesystem-specific function tables defined by the struct
file_operations and struct inode_operations structures.

Cheers,
Stephen.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/faq.html