cache read performance improvements
This commit is contained in:
parent
39c4720e40
commit
f69d3149f3
14 changed files with 140 additions and 71 deletions
|
|
@ -389,16 +389,16 @@ func (md *Metadata) AddChunk(off int64, n int) {
|
|||
md.Chunks.Add(off, n)
|
||||
}
|
||||
|
||||
func (md *Metadata) ReadAt(p []byte, pos int64) (int, error) {
|
||||
if md.f == nil {
|
||||
err := md.openCacheFile()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
atomic.StoreInt64(&md.Atime, now())
|
||||
return md.f.ReadAt(p, pos)
|
||||
}
|
||||
//func (md *Metadata) ReadAt(p []byte, pos int64) (int, error) {
|
||||
// if md.f == nil {
|
||||
// err := md.openCacheFile()
|
||||
// if err != nil {
|
||||
// return 0, err
|
||||
// }
|
||||
// }
|
||||
// atomic.StoreInt64(&md.Atime, now())
|
||||
// return md.f.ReadAt(p, pos)
|
||||
//}
|
||||
|
||||
func (md *Metadata) WriteAt(data []byte, pos int64) (int, error) {
|
||||
if md.f == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue