MCPcopy
hub / github.com/cubefs/cubefs / InodeGet

Method InodeGet

client/fs/inode.go:33–120  ·  view source on GitHub ↗
(ino uint64)

Source from the content-addressed store, hash-verified

31)
32
33func (s *Super) InodeGet(ino uint64) (info *proto.InodeInfo, err error) {
34 info = s.ic.Get(ino)
35
36 if info != nil {
37 return info, nil
38 }
39
40 if s.metaCacheAcceleration {
41 info, err = s.mw.InodeGetExt_ll(ino)
42 } else {
43 info, err = s.mw.InodeGet_ll(ino)
44 }
45 if err != nil || info == nil {
46 log.LogErrorf("InodeGet: ino(%v) err(%v) info(%v)", ino, err, info)
47 if err != nil {
48 return nil, ParseError(err)
49 } else {
50 return nil, fuse.ENOENT
51 }
52 }
53 s.ic.Put(info)
54 s.fslock.Lock()
55 node, isFind := s.nodeCache[ino]
56 s.fslock.Unlock()
57 if isFind {
58 s, ok := node.(*Dir)
59 if ok {
60 s.info = info
61 } else {
62 migrated := info.StorageClass != node.(*File).info.StorageClass
63 // the first time storage class change to blob store
64 if migrated && proto.IsStorageClassBlobStore(info.StorageClass) {
65 f := node.(*File)
66 fileSize, _ := f.fileSizeVersion2(f.info.Inode)
67 clientConf := blobstore.ClientConfig{
68 VolName: f.super.volname,
69 VolType: f.super.volType,
70 BlockSize: f.super.EbsBlockSize,
71 Ino: f.info.Inode,
72 Bc: f.super.bc,
73 Mw: f.super.mw,
74 Ec: f.super.ec,
75 Ebsc: f.super.ebsc,
76 EnableBcache: f.super.enableBcache,
77 WConcurrency: f.super.writeThreads,
78 ReadConcurrency: f.super.readThreads,
79 FileCache: false,
80 FileSize: uint64(fileSize),
81 StorageClass: f.info.StorageClass,
82 }
83 f.fWriter.FreeCache()
84 switch f.flag & 0x0f {
85 case syscall.O_RDONLY:
86 log.LogDebugf("InodeGet: ino(%v) migrate(%v) info(%v) flag(%v) O_RDONLY", ino, migrated, info, f.flag)
87 f.fReader = blobstore.NewReader(clientConf)
88 f.fWriter = nil
89 case syscall.O_WRONLY:
90 log.LogDebugf("InodeGet: ino(%v) migrate(%v) info(%v) flag(%v) O_WRONLY", ino, migrated, info, f.flag)

Callers 1

RootMethod · 0.95

Calls 15

LogErrorfFunction · 0.92
IsStorageClassBlobStoreFunction · 0.92
LogDebugfFunction · 0.92
NewReaderFunction · 0.92
NewWriterFunction · 0.92
LogInfofFunction · 0.92
ParseErrorFunction · 0.85
InodeGetExt_llMethod · 0.80
LockMethod · 0.80
fileSizeVersion2Method · 0.80
FreeCacheMethod · 0.80
HasExtentsMethod · 0.80

Tested by

no test coverage detected