Cleanups in tiered storage and apply semaphores.

This commit adds semaphores for memory and disk storage.