Looking closer, how to do what I want seems murky. Basically, I
want a memory based filesystem, for a 'tempfs' style thing.
The snags are:
The page cache discards pages without having a chance to write
them anywhere (it assumes the coming from a real device, and
that the pages are all temporary pages that can be discarded).
Tracking this down, I don't see any connection between writing
to a page and it ever getting written out. The generic_write_page
might be OK, but noone but nfs/autofs even uses that. Looking at
minixfs, it uses generic_read_file and minix_write_file, and
minix_write_file seems to operate on buffers, not pages.
So now it seems, if I have read_page just return one of my own
pages; the system can discard that page behind my back. But if
I return a copy of a page, then that's a waste of memory. (maybe
just discard my copy if it's on disc)
Hmm, maybe I should use NFS as my guide, since it doesn't use
a device underneath.