This is a step towards making compile_commands.json reloadable.
The idea is:
- in addition to rare CDB loads we're soon going to have somewhat-rare CDB reloads and fairly-common stat() of files to validate the CDB
- so stop doing all our work under a big global lock, instead using it to acquire per-directory structures with their own locks
- each directory can be refreshed from disk every N seconds, like filecache
- avoid locking these at all in the most common case: directory has no CDB
it is kind of hard to figure out if this mutex is also meant for OnlyDirCache. maybe separate it with a line or put some explicit governed by annotations?