Use a rwlock to prevent files from being written concurrently or read while written
Add some instrumentation