Skip to content

Commit f476b48

Browse files
kavehahmadi60facebook-github-bot
authored andcommitted
record number of inodes before and after GC in edenfs logs
Summary: Record total number of loaded/unloaded inodes before and after GC. It will help us to see how efficient the GC was Reviewed By: jdelliot, MichaelCuevas Differential Revision: D75317304 fbshipit-source-id: cf281a6eda7e33b1efa5887a342ddcab86385440
1 parent d1c78dc commit f476b48

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

eden/fs/service/EdenServer.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,14 +2738,22 @@ ImmediateFuture<uint64_t> EdenServer::garbageCollectWorkingCopy(
27382738
}
27392739

27402740
auto mountPath = mount.getPath();
2741-
XLOGF(DBG1, "Starting GC for: {}", mountPath);
2741+
auto inodeCountsBeforeGC = mount.getInodeMap()->getInodeCounts();
2742+
auto totalNumberOfInodesBeforeGC = inodeCountsBeforeGC.fileCount +
2743+
inodeCountsBeforeGC.treeCount + inodeCountsBeforeGC.unloadedInodeCount;
2744+
XLOGF(
2745+
DBG1,
2746+
"Starting GC for: {} total number of inodes {}",
2747+
mountPath,
2748+
totalNumberOfInodesBeforeGC);
27422749
return inode->invalidateChildrenNotMaterialized(cutoff, context)
27432750
.ensure([inode, lease = std::move(lease)] {
27442751
inode->unloadChildrenUnreferencedByFs();
27452752
})
27462753
.thenTry([workingCopyRuntime,
27472754
structuredLogger = structuredLogger_,
2748-
mountPath = std::move(mountPath)](
2755+
mountPath,
2756+
inodeMap = mount.getInodeMap()](
27492757
folly::Try<uint64_t> numInvalidatedTry) {
27502758
auto runtime =
27512759
std::chrono::duration<double>{workingCopyRuntime.elapsed()};
@@ -2755,13 +2763,17 @@ ImmediateFuture<uint64_t> EdenServer::garbageCollectWorkingCopy(
27552763
success ? folly::to_signed(numInvalidatedTry.value()) : 0;
27562764
structuredLogger->logEvent(
27572765
WorkingCopyGc{runtime.count(), numInvalidated, success});
2758-
2766+
auto inodeCountsAfterGC = inodeMap->getInodeCounts();
2767+
auto totalNumberOfInodesAfterGC = inodeCountsAfterGC.fileCount +
2768+
inodeCountsAfterGC.treeCount +
2769+
inodeCountsAfterGC.unloadedInodeCount;
27592770
XLOGF(
27602771
DBG1,
2761-
"GC for: {}, completed in: {} seconds and invalidated {} inodes",
2772+
"GC for: {}, completed in: {} seconds and invalidated {} inodes, total number of inodes {}",
27622773
mountPath,
27632774
runtime.count(),
2764-
numInvalidated);
2775+
numInvalidated,
2776+
totalNumberOfInodesAfterGC);
27652777

27662778
return numInvalidatedTry;
27672779
});

0 commit comments

Comments
 (0)