Daire Byrne <Daire.Byrne@xxxxxxxxxxxxxx> wrote: > > Caching negative results would certainly be possible, provided you can > > determine that the directory has been updated when a previously negative > > entry has been instantiated. This can probably be done reasonably by > > checking the mtime and ctime on the dir. > > Ah yes - that makes sense. So you would do lots of opens() and access() > calls the first time on non-existent files and then subsequently only read > from the cache? But wouldn't you still need to check the parent dir > ctime/mtime from the network for every call to ensure nothing in those dirs > has changed? Perhaps you only want to do this periodically for better > performance/less net I/O? The same applies to data cached from regular files. How and when do you determine if it is obsolete? There are two ways to do this: (1) Ask the server to notify you on change. I don't know whether NFS4 provides leases on directories as it does for files. With AFS, as with a file, you get a callback if a directory you have read gets modified, but I don't know if this is possible for NFS. (2) Poll the server occasionally, but less frequently than the accesses, if the accesses are very frequent. That can be made configurable, and may already be partially implemented (see the 'lookupcache' mount option and also 'acdirmin' and 'acdirmax'). > It seems to me that we would want some more mount options so that you can > decide at mount time how secure or accurate you want the cached mountpoint to > be at the expense of performance. Indeed. It depends on what you're willing to put up with in terms of correctness guarantees. > Pretty much, expect that I think it should be reasonable to write directly > back to NFS to the separate COW image without any caching (and is a > requirement for live migration anyway). I would think that the read/write > ratio of a Linux VM image is such that the writes will generate much less > load on an NFS server than reads would (without NFS caching). It sounds like unionfs or an overlay of NFS on NFS might actually be what you're looking for. FS-Cache could then be used with the upper (writable) layer. David -- Linux-cachefs mailing list Linux-cachefs@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/linux-cachefs