volume: dataFileAccessLock change to RW Lock

This commit is contained in:
Chris Lu
2019-12-06 06:59:57 -08:00
parent 81f424a630
commit 6827cabfbb
3 changed files with 19 additions and 19 deletions

View File

@@ -136,8 +136,8 @@ func (v *Volume) deleteNeedle(n *needle.Needle) (uint32, error) {
// read fills in Needle content by looking up n.Id from NeedleMapper
func (v *Volume) readNeedle(n *needle.Needle) (int, error) {
v.dataFileAccessLock.Lock()
defer v.dataFileAccessLock.Unlock()
v.dataFileAccessLock.RLock()
defer v.dataFileAccessLock.RUnlock()
nv, ok := v.nm.Get(n.Id)
if !ok || nv.Offset.IsZero() {