mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
FUSE mount: fix file id written twice?
fix https://github.com/chrislusf/seaweedfs/issues/1373
This commit is contained in:
parent
212c64241b
commit
3cec4b3c49
|
@ -90,6 +90,9 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {
|
|||
found = true
|
||||
if c.bufferOffset != chunk.LogicOffset {
|
||||
c.buffer, err = c.fetchChunkData(chunk)
|
||||
if err != nil {
|
||||
glog.Errorf("fetching chunk %+v: %v\n", chunk, err)
|
||||
}
|
||||
c.bufferOffset = chunk.LogicOffset
|
||||
}
|
||||
break
|
||||
|
@ -99,7 +102,9 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {
|
|||
return 0, io.EOF
|
||||
}
|
||||
|
||||
n = copy(p, c.buffer[offset-c.bufferOffset:])
|
||||
if err == nil {
|
||||
n = copy(p, c.buffer[offset-c.bufferOffset:])
|
||||
}
|
||||
|
||||
// fmt.Printf("> doReadAt [%d,%d), buffer:[%d,%d)\n", offset, offset+int64(n), c.bufferOffset, c.bufferOffset+int64(len(c.buffer)))
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ func (file *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
|||
|
||||
func (file *File) Forget() {
|
||||
t := util.NewFullPath(file.dir.FullPath(), file.Name)
|
||||
glog.V(3).Infof("Forget file %s", t)
|
||||
glog.V(4).Infof("Forget file %s", t)
|
||||
}
|
||||
|
||||
func (file *File) maybeLoadEntry(ctx context.Context) error {
|
||||
|
|
|
@ -60,7 +60,7 @@ func (c *ChunkCache) doGetChunk(fileId string, chunkSize uint64) (data []byte) {
|
|||
|
||||
for _, diskCache := range c.diskCaches {
|
||||
data := diskCache.getChunk(fid.Key)
|
||||
if len(data) != 0 {
|
||||
if len(data) != 0 && len(data) >= int(chunkSize) {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue