mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-20 02:38:04 +08:00
FUSE mount: fix file id written twice?
fix https://github.com/chrislusf/seaweedfs/issues/1373
This commit is contained in:
@@ -90,6 +90,9 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {
|
|||||||
found = true
|
found = true
|
||||||
if c.bufferOffset != chunk.LogicOffset {
|
if c.bufferOffset != chunk.LogicOffset {
|
||||||
c.buffer, err = c.fetchChunkData(chunk)
|
c.buffer, err = c.fetchChunkData(chunk)
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("fetching chunk %+v: %v\n", chunk, err)
|
||||||
|
}
|
||||||
c.bufferOffset = chunk.LogicOffset
|
c.bufferOffset = chunk.LogicOffset
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@@ -99,7 +102,9 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {
|
|||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
n = copy(p, c.buffer[offset-c.bufferOffset:])
|
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)))
|
// 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() {
|
func (file *File) Forget() {
|
||||||
t := util.NewFullPath(file.dir.FullPath(), file.Name)
|
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 {
|
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 {
|
for _, diskCache := range c.diskCaches {
|
||||||
data := diskCache.getChunk(fid.Key)
|
data := diskCache.getChunk(fid.Key)
|
||||||
if len(data) != 0 {
|
if len(data) != 0 && len(data) >= int(chunkSize) {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user