fix(flash_cache): optimize get inode meta info when prepareCacheRequests.#22240020

Signed-off-by: baihailong <baihailong@oppo.com>
This commit is contained in:
baihailong 2024-08-28 15:30:03 +08:00 committed by zhumingze1108
parent 3cbf7153ea
commit d6b862922d
3 changed files with 13 additions and 6 deletions

View File

@ -239,6 +239,7 @@ func NewSuper(opt *proto.MountOptions) (s *Super, err error) {
OnLoadBcache: s.bc.Get,
OnCacheBcache: s.bc.Put,
OnEvictBcache: s.bc.Evict,
OnGetInodeInfo: s.InodeGet,
DisableMetaCache: DisableMetaCache,
MinWriteAbleDataPartitionCnt: opt.MinWriteAbleDataPartitionCnt,

View File

@ -140,6 +140,7 @@ type ExtentConfig struct {
OnLoadBcache LoadBcacheFunc
OnCacheBcache CacheBcacheFunc
OnEvictBcache EvictBacheFunc
OnGetInodeInfo GetInodeInfoFunc
DisableMetaCache bool
MinWriteAbleDataPartitionCnt int
@ -207,11 +208,12 @@ type ExtentClient struct {
InnerReq bool
AheadRead *AheadReadCache
extentConfig *ExtentConfig
RemoteCache RemoteCache
stopOnce sync.Once
stopCh chan struct{}
wg sync.WaitGroup
extentConfig *ExtentConfig
RemoteCache RemoteCache
stopOnce sync.Once
stopCh chan struct{}
wg sync.WaitGroup
getInodeInfo GetInodeInfoFunc
}
func (client *ExtentClient) UidIsLimited(uid uint32) bool {

View File

@ -164,7 +164,11 @@ func (s *Streamer) prepareCacheRequests(offset, size uint64, data []byte) ([]*Ca
log.LogWarnf("Streamer prepareCacheRequests: getDataSource failed. fixedOff(%v) err(%v)", fixedOff, err)
return nil, err
}
info, _ := s.client.metaWrapper.InodeGet_ll(s.inode)
info, err := s.client.getInodeInfo(s.inode)
if err != nil {
log.LogWarnf("Streamer prepareCacheRequests: getInodeInfo failed. fixedOff(%v) err(%v)", fixedOff, err)
return nil, err
}
gen := info.Generation
cReq := &proto.CacheRequest{