Yaffs: Change cache policy
When the cache is full and a new cache entry is needed, then space has
to be made. This is sometimes termed push out.
Until now, the push out involved finding the least recently used cache
entry then pushing out all entries in the same file.
This had the unintended consequence of making "bursty" writes and forcing
extra reads under some conditions.
Since the same code path was being used for fsync() and flushing, this
also meant that flushing a file caused the file to be thrown out of the
cache. That is not a very useful thing to do.
These changes are twofold:
1. Only push out the LRU cache entry, rather than the whole file. This
makes for a "smoother" push out. It also saves some reads.
2. Flushing a file no longer invalidates the file in cache, it just writes
dirty cache entries. This makes better use of the cache.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>