Messages in this thread | | | Date | Mon, 18 Aug 1997 20:31:34 -0700 (PDT) | From | Darin Johnson <> | Subject | Re: questions on page cache and buffers |
| |
> For a memory/swap file system, I'm not quite clear on what you need, > but it's a combination of the "private" mapping code (with the > file_private_mmap vm_operations_struct so pages get sent to swap space) > but you want your pages to be indexed in the page cache. That may > require some tweaking of the swap_in code. > > I think you just want everything in the page cache, some completely > anonymous pages for metadata, and some indexed pages for file data. > Doing that, 99% of file accesses will be hits in the page cache and > you don't have to worry about I/O to them at all. > -- > -Colin
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.
| |