how does generic_file_read work with page_cache?

Peter J. Braam (braam@cs.cmu.edu)
Wed, 22 Sep 1999 03:39:07 +0000


Hi

I wondered if someone could explain what is happening in
generic_file_read and the page cache.

More generically, I'd like to understand how in a file system I can
"get" a page and use it to copy date into/out of it. How do I then put
the page away? [I'm working on some experiments for a cluster file
system exploiting object based disks, see
ftp://ftp.inter-mezzo.org/pub/obd for some sample code.]

There seem to be several patterns, but I can't figure them out:
- functions modifying a page tend to lock the page, and unlock them
understandbly
- functions reading the page do a page_get -- but there is no page_put,
instead they call the un-understandable page_cache_release.

Below in the snippet from generic_page read, the normal path does:

get_page(page)
if all is well copy the data from the page
page_cache_release(page)

But the latter is in fact __free_page(page) which is defined in
page_alloc.c and is very appropriately labeled as "You really aren't
expected to understand this".

- What does that function do with the page?
- Who sets back the page count, which was increased by get_page?
- How can I operate with pages in a file system?

Surely I'm totally confused, can someone explain what I'm missing?

- Peter -

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