make reader_at handle random reads more efficiently for FUSE

This commit is contained in:
Nathan Hawkins
2021-04-28 19:13:37 -04:00
parent 83cf94ad2d
commit 042de9359c
6 changed files with 152 additions and 7 deletions

View File

@@ -82,6 +82,28 @@ func (c *OnDiskCacheLayer) getChunk(needleId types.NeedleId) (data []byte) {
}
func (c *OnDiskCacheLayer) getChunkSlice(needleId types.NeedleId, offset, length uint64) (data []byte) {
var err error
for _, diskCache := range c.diskCaches {
data, err = diskCache.getNeedleSlice(needleId, offset, length)
if err == storage.ErrorNotFound {
continue
}
if err != nil {
glog.Errorf("failed to read cache file %s id %d", diskCache.fileName, needleId)
continue
}
if len(data) != 0 {
return
}
}
return nil
}
func (c *OnDiskCacheLayer) shutdown() {
for _, diskCache := range c.diskCaches {