File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,6 +333,19 @@ IOStatus ZenFS::Repair() {
333333 return IOStatus::OK ();
334334}
335335
336+ void ZenFS::RebuildZoneLifeTime () {
337+ std::map<std::string, std::shared_ptr<ZoneFile>>::iterator it;
338+ for (it = files_.begin (); it != files_.end (); it++) {
339+ std::shared_ptr<ZoneFile> zFile = it->second ;
340+ std::vector<ZoneExtent*> extents = zFile->GetExtents ();
341+ Env::WriteLifeTimeHint file_lifetime = zFile->GetWriteLifeTimeHint ();
342+ for (const auto * ext : extents) {
343+ Zone* zone = ext->zone_ ;
344+ if (zone->lifetime_ < file_lifetime) zone->lifetime_ = file_lifetime;
345+ }
346+ }
347+ }
348+
336349std::string ZenFS::FormatPathLexically (fs::path filepath) {
337350 fs::path ret = fs::path (" /" ) / filepath.lexically_normal ();
338351 return ret.string ();
@@ -1471,6 +1484,8 @@ Status ZenFS::Mount(bool readonly) {
14711484 }
14721485 }
14731486
1487+ RebuildZoneLifeTime ();
1488+
14741489 Info (logger_, " Superblock sequence %d" , (int )superblock_->GetSeq ());
14751490 Info (logger_, " Finish threshold %u" , superblock_->GetFinishTreshold ());
14761491 Info (logger_, " Filesystem mount OK" );
Original file line number Diff line number Diff line change @@ -252,6 +252,8 @@ class ZenFS : public FileSystemWrapper {
252252
253253 IOStatus Repair ();
254254
255+ void RebuildZoneLifeTime ();
256+
255257 /* Must hold files_mtx_ */
256258 IOStatus DeleteDirRecursiveNoLock (const std::string& d,
257259 const IOOptions& options,
You can’t perform that action at this time.
0 commit comments