|
@ -14,7 +14,7 @@ import ( |
|
|
type ContinuousDirtyPages struct { |
|
|
type ContinuousDirtyPages struct { |
|
|
intervals *ContinuousIntervals |
|
|
intervals *ContinuousIntervals |
|
|
f *File |
|
|
f *File |
|
|
fh *FileHandle |
|
|
|
|
|
|
|
|
writeOnly bool |
|
|
writeWaitGroup sync.WaitGroup |
|
|
writeWaitGroup sync.WaitGroup |
|
|
chunkAddLock sync.Mutex |
|
|
chunkAddLock sync.Mutex |
|
|
lastErr error |
|
|
lastErr error |
|
@ -22,10 +22,11 @@ type ContinuousDirtyPages struct { |
|
|
replication string |
|
|
replication string |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func newDirtyPages(file *File) *ContinuousDirtyPages { |
|
|
|
|
|
|
|
|
func newDirtyPages(file *File, writeOnly bool) *ContinuousDirtyPages { |
|
|
dirtyPages := &ContinuousDirtyPages{ |
|
|
dirtyPages := &ContinuousDirtyPages{ |
|
|
intervals: &ContinuousIntervals{}, |
|
|
intervals: &ContinuousIntervals{}, |
|
|
f: file, |
|
|
f: file, |
|
|
|
|
|
writeOnly: writeOnly, |
|
|
} |
|
|
} |
|
|
return dirtyPages |
|
|
return dirtyPages |
|
|
} |
|
|
} |
|
@ -106,7 +107,7 @@ func (pages *ContinuousDirtyPages) saveToStorage(reader io.Reader, offset int64, |
|
|
defer pages.writeWaitGroup.Done() |
|
|
defer pages.writeWaitGroup.Done() |
|
|
|
|
|
|
|
|
reader = io.LimitReader(reader, size) |
|
|
reader = io.LimitReader(reader, size) |
|
|
chunk, collection, replication, err := pages.f.wfs.saveDataAsChunk(pages.f.fullpath(), pages.fh.writeOnly)(reader, pages.f.Name, offset) |
|
|
|
|
|
|
|
|
chunk, collection, replication, err := pages.f.wfs.saveDataAsChunk(pages.f.fullpath(), pages.writeOnly)(reader, pages.f.Name, offset) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
glog.V(0).Infof("%s saveToStorage [%d,%d): %v", pages.f.fullpath(), offset, offset+size, err) |
|
|
glog.V(0).Infof("%s saveToStorage [%d,%d): %v", pages.f.fullpath(), offset, offset+size, err) |
|
|
pages.lastErr = err |
|
|
pages.lastErr = err |
|
|