diff options
| author | chrislu <chris.lu@gmail.com> | 2022-03-21 02:09:54 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-03-21 02:09:54 -0700 |
| commit | 4e2388e1b5dfd1b9281a751f290ac42d593d8103 (patch) | |
| tree | 3178ca73f4b6a142f5a33bb3cf8010bfd7baa95f | |
| parent | 8f0410af2c01e158e85a635e3d6725ac6b966e1f (diff) | |
| download | seaweedfs-4e2388e1b5dfd1b9281a751f290ac42d593d8103.tar.xz seaweedfs-4e2388e1b5dfd1b9281a751f290ac42d593d8103.zip | |
mount: set file size if it is only on remote gateway
| -rw-r--r-- | weed/filer/filechunks.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go index d18d06f2c..fd9694b38 100644 --- a/weed/filer/filechunks.go +++ b/weed/filer/filechunks.go @@ -23,7 +23,13 @@ func TotalSize(chunks []*filer_pb.FileChunk) (size uint64) { } func FileSize(entry *filer_pb.Entry) (size uint64) { - return maxUint64(TotalSize(entry.Chunks), entry.Attributes.FileSize) + fileSize := entry.Attributes.FileSize + if entry.RemoteEntry != nil { + if entry.RemoteEntry.RemoteMtime > entry.Attributes.Mtime { + fileSize = maxUint64(fileSize, uint64(entry.RemoteEntry.RemoteSize)) + } + } + return maxUint64(TotalSize(entry.Chunks), fileSize) } func ETag(entry *filer_pb.Entry) (etag string) { |
