MCPcopy Create free account
hub / github.com/bytedance/bolt / possibleSsdSave

Method possibleSsdSave

bolt/common/caching/AsyncDataCache.cpp:878–897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878void AsyncDataCache::possibleSsdSave(uint64_t bytes) {
879 constexpr int32_t kMinSavePages = 4096; // Save at least 16MB at a time.
880 if (ssdCache_ == nullptr) {
881 return;
882 }
883
884 ssdSaveable_ += bytes;
885 if (memory::AllocationTraits::numPages(ssdSaveable_) >
886 std::max<int32_t>(kMinSavePages, cachedPages_ / 8)) {
887 // Do not start a new save if another one is in progress.
888 if (!ssdCache_->startWrite()) {
889 return;
890 }
891 LOG(INFO) << "possibleSsdSave:" << ssdSaveable_ << "--"
892 << memory::AllocationTraits::kPageSize << "--"
893 << ssdSaveable_ / memory::AllocationTraits::kPageSize << "--"
894 << std::max<int32_t>(kMinSavePages, cachedPages_ / 8);
895 saveToSsd();
896 }
897}
898
899void AsyncDataCache::saveToSsd() {
900 std::vector<CachePin> pins;

Callers 1

setExclusiveToSharedMethod · 0.80

Calls 1

startWriteMethod · 0.45

Tested by

no test coverage detected