Here is the second attempt at improving the access cache. I believe all of the concerns from the first patch have been addressed. Chuck Lever wrote: > > 1. We already have cache shrinkage built in: when an inode is purged > due to cache shrinkage, the access cache for that inode is purged as > well. In other words, there is already a mechanism for external memory > pressure to shrink this cache. I don't see a strong need to complicate > matters by adding more cache shrinkage than already exists with normal > inode and dentry cache shrinkage. I agree... so there no extra code to shrink this cache. > > 2. Use a radix tree per inode. Using radix trees actual makes things much simpler... Good idea, imo. > > 3. Instead of serializing by spinning, you should use a semaphore. I turns out that spin lock are probably better protecting this cache because while looking up the cache entry I might have to discard the entry, so I would have to upgrade a read semaphore to a write one which is a bit messy and not needed imho... But I do agree with you about global locks, so I added the spin lock to the nfs_inode. > > You will need to serialize on-the-wire requests with accesses to the > cache, and such wire requests will need the waiting processes to sleep, > not spin. True... so I use added a bit to the nfs_inode flags that will serialize over-the-write request similar to how getattrs are. > > 4. You will need some mechanism for ensuring that the contents of the > access cache are "up to date". This cache is tied to the attribute cache and when that times out or is invalided, the cache entry is discarded... With my testing, this seems to just fine. > > 5. You need to handle ESTALE. True... and this patch does. Comments? steved.