doubt about 99% of the cases if the first byte of the file is cached.

Liang Yang <[email protected]>
Newsgroups gmane.network.tux
Message-ID <[email protected]>
Hi, Ingo

Last time you told me "for 99% of the cases if the first byte
of the file is cached then the whole file is cached."

But I think the probability will be decreased from 99% if the file
size increase dramatically. Now we try to let a TUX server a
10 MB file, we found do_generic_file_read will indicate this
file is already in the cache when it is invoked for the second time.
But we noticed the Hard Disk LED of server flashed for a long time
when the server received the file request even for the second
time(e.g. the file should be in the cache now). It seems Linux
try to read something(the part of file in disk?) from the disk.

So we think this file may be partially cached. But we don't know
when Linux will begin to partially cache this file if the file size
reached some limit.

So in this case we need to do some nonblocking read to more
pages instead of only 1st byte to find out how many pages are actaully
cached
by Linux.

How can we do it? Maybe we can still use do_generic_file_read with
req->desc.count being set to the size we want to read? then if
req->desc.err=0,
we can just use req->desc.count divided by  page size to calculate how many
pages of the file are cached by Linux?

But I think maybe this method is boring. If req->desc.err==-EWOULDBLOCKID
then
we have to decrease req->desc.count a little bit and try again till
req->desc.err=0.
Is this correct? Is this cached page count always fixed for the same size
files?

BTW, can you told me what's total cache size for files given a specific main
memory size
in Linux? Is this total file cache size fixed? We need this information to
design our test cases.

Liang Yang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.