kernel - Spiff up locks a bit
* Do a little optimization of _spin_lock_contested(). The critical path
is able to avoid two atomic ops in the initialization portion of the
contested path.
* Optimize _spin_lock_shared_contested() to use atomic_fetchadd_long()
to add a shared-lock count instead of atomic_cmpset_long(). Shared
spinlocks are used heavily and this will prevent a lot of unnecessary
spinning when many cpus are using the same lock at the same time.
* Hold fdp->fd_spin across fdp->fd_cdir and fdp->fd_ncdir modifications.
This completes other work which caches fdp->fd_ncdir and avoids having
to obtain the spin-lock when the cache matches.
Discussed-with: Mateusz Guzik (mjg_)