Re: [RFC] first try for swap prefetch

Andrew Morton (akpm@digeo.com)
Fri, 11 Apr 2003 22:37:18 -0700


Thomas Schlichter <schlicht@uni-mannheim.de> wrote:
>
> How can I get the file pointer for a buffered page with the information
> available in the kswapd (minly the page struct)??

You can't, really. There can be any number of file*'s pointing at an inode.

The pagefault handler will find it by find_vma(faulting_address)->vm_file.
Other codepaths use syscalls, and the user passed the file* in.

You can call page_cache_readahead() with a NULL file*. That'll mostly work
except for the odd filesytem like NFS which will oops. But it's good enough
for testing and development.

Or you could cook up a local file struct along the lines of
fs/nfsd/vfs.c:nfsd_read(), but I would not like to lead a young person
that way ;)

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