MCPcopy
hub / github.com/cubefs/cubefs / fileSizeVersion2

Method fileSizeVersion2

client/fs/file.go:925–945  ·  view source on GitHub ↗
(ino uint64)

Source from the content-addressed store, hash-verified

923}
924
925func (f *File) fileSizeVersion2(ino uint64) (size int, gen uint64) {
926 size, gen, valid := f.super.ec.FileSize(ino)
927 if proto.IsCold(f.super.volType) || proto.IsStorageClassBlobStore(f.info.StorageClass) {
928 valid = false
929 }
930 if !valid {
931 if info, err := f.super.InodeGet(ino); err == nil {
932 size = int(info.Size)
933 if f.fWriter != nil {
934 cacheSize := f.fWriter.CacheFileSize()
935 if cacheSize > size {
936 size = cacheSize
937 }
938 }
939 gen = info.Generation
940 }
941 }
942
943 log.LogDebugf("TRACE fileSizeVersion2: ino(%v) fileSize(%v) gen(%v) valid(%v)", ino, size, gen, valid)
944 return
945}
946
947// return true mean this file will not cache in block cache
948func (f *File) filterFilesSuffix(filterFiles string) bool {

Callers 3

AttrMethod · 0.95
OpenMethod · 0.95
InodeGetMethod · 0.80

Calls 6

IsColdFunction · 0.92
IsStorageClassBlobStoreFunction · 0.92
LogDebugfFunction · 0.92
FileSizeMethod · 0.80
CacheFileSizeMethod · 0.80
InodeGetMethod · 0.65

Tested by

no test coverage detected