MCPcopy
hub / github.com/cubefs/cubefs / spaceManager

Method spaceManager

client/blockcache/bcache/manage.go:310–338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

308}
309
310func (bm *bcacheManager) spaceManager() {
311 ticker := time.NewTicker(SpaceCheckInterval)
312 tmpTicker := time.NewTicker(TmpFileCheckInterval)
313
314 defer func() {
315 ticker.Stop()
316 tmpTicker.Stop()
317 }()
318 for {
319 select {
320 case <-ticker.C:
321 for _, store := range bm.bstore {
322 useRatio, files := store.diskUsageRatio()
323 log.LogDebugf("useRation(%v), files(%v)", useRatio, files)
324 if 1-useRatio < store.freeLimit || files > int64(store.limit) {
325 bm.freeSpace(store, 1-useRatio, files)
326 }
327 bm.cacheMetaCount.SetWithLabelValues(float64(useRatio), bm.vol, store.dir, "useRatio")
328 bm.cacheMetaCount.SetWithLabelValues(float64(files), bm.vol, store.dir, "files")
329 }
330 case <-tmpTicker.C:
331 for _, store := range bm.bstore {
332 useRatio, files := store.diskUsageRatio()
333 log.LogInfof("useRation(%v), files(%v)", useRatio, files)
334 bm.deleteTmpFile(store)
335 }
336 }
337 }
338}
339
340//lru cache
341//func (bm *bcacheManager) freeSpace(index int, store *DiskStore, free float32, files int64) {

Callers 1

newBcacheManagerFunction · 0.95

Calls 7

freeSpaceMethod · 0.95
deleteTmpFileMethod · 0.95
LogDebugfFunction · 0.92
LogInfofFunction · 0.92
diskUsageRatioMethod · 0.80
SetWithLabelValuesMethod · 0.80
StopMethod · 0.65

Tested by

no test coverage detected