|
@ -108,10 +108,11 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f |
|
|
// fmt.Printf("truncate %v \n", fullPath)
|
|
|
// fmt.Printf("truncate %v \n", fullPath)
|
|
|
var chunks []*filer_pb.FileChunk |
|
|
var chunks []*filer_pb.FileChunk |
|
|
for _, chunk := range file.entry.Chunks { |
|
|
for _, chunk := range file.entry.Chunks { |
|
|
if uint64(chunk.Offset)+chunk.Size > req.Size { |
|
|
|
|
|
chunk.Size = req.Size - uint64(chunk.Offset) |
|
|
|
|
|
|
|
|
int64Size := int64(chunk.Size) |
|
|
|
|
|
if chunk.Offset+int64Size > int64(req.Size) { |
|
|
|
|
|
int64Size = int64(req.Size) - chunk.Offset |
|
|
} |
|
|
} |
|
|
if chunk.Size > 0 { |
|
|
|
|
|
|
|
|
if int64Size > 0 { |
|
|
chunks = append(chunks, chunk) |
|
|
chunks = append(chunks, chunk) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|