kernel - Fix bugs and refactor namecache cleaning code
* Refactor the cleaning code. For positive namecache entries,
track based on NCHHASH linkages rather than v_namecache linkages.
Also maintain a count of freeable (leaf) entries and use that
in the _cache_cleanpos() code.
This should hopefully fix a bug where the system can get stuck
constantly calling _cache_cleanpos() in situations where there
are not any freeable entries.
* Refactor the negative namecache tracking code. Move to a per-cpu
structure where entries are made based on the current cpu and removed
based on the recorded cpu. Refactor the cleaning code to iterate
the cpu list on a per-call basis which should hopefully allow multiple
cpus to clean the ncneg lists concurrently.
This reduces a SMP bottleneck, but does not deal with cache
ping-ponging issues on related structures.
Reported-by: ftigeot