Skip to content

Commit 25ed6ac

Browse files
kavehahmadi60facebook-github-bot
authored andcommitted
fix some minor lints in TreeInodes.cpp
Summary: I was playing with `TreeInodes.cpp` and I found a few lint warnings and a wrong comment. Reviewed By: jdelliot Differential Revision: D75092377 fbshipit-source-id: 67dba155f5ae76d5a18ef167b2c48ca5851cda48
1 parent dd1b2ff commit 25ed6ac

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

eden/fs/inodes/TreeInode.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ void TreeInode::childMaterialized(
922922
const RenameLock& renameLock,
923923
PathComponentPiece childName) {
924924
auto startTime = std::chrono::system_clock::now();
925-
bool wasAlreadyMaterialized;
925+
bool wasAlreadyMaterialized = false;
926926
{
927927
auto contents = contents_.wlock();
928928
wasAlreadyMaterialized = contents->isMaterialized();
@@ -980,7 +980,7 @@ void TreeInode::childDematerialized(
980980
PathComponentPiece childName,
981981
ObjectId childScmHash) {
982982
auto startTime = std::chrono::system_clock::now();
983-
bool wasAlreadyMaterialized;
983+
bool wasAlreadyMaterialized = false;
984984
{
985985
auto contents = contents_.wlock();
986986
wasAlreadyMaterialized = contents->isMaterialized();
@@ -3041,6 +3041,7 @@ ImmediateFuture<Unit> TreeInode::computeDiff(
30413041

30423042
// Now process all of the deferred work.
30433043
std::vector<ImmediateFuture<Unit>> deferredFutures;
3044+
deferredFutures.reserve(deferredEntries.size());
30443045
for (auto& entry : deferredEntries) {
30453046
deferredFutures.push_back(entry->run());
30463047
}
@@ -3058,7 +3059,7 @@ ImmediateFuture<Unit> TreeInode::computeDiff(
30583059
return collectAll(std::move(deferredFutures));
30593060
})
30603061
.thenValue([self = std::move(self),
3061-
currentPath = RelativePath{std::move(currentPath)},
3062+
currentPath = RelativePath{currentPath},
30623063
context,
30633064
// Capture ignore to ensure it remains valid until all of our
30643065
// children's diff operations complete.
@@ -3907,7 +3908,7 @@ ImmediateFuture<InvalidationRequired> TreeInode::checkoutUpdateEntry(
39073908
CaseSensitivity::Insensitive);
39083909
}
39093910

3910-
bool inserted;
3911+
bool inserted = false;
39113912
{
39123913
auto contents = parentInode->contents_.wlock();
39133914
auto ret = contents->entries.emplace(
@@ -3961,7 +3962,7 @@ folly::Try<folly::Unit> TreeInode::nfsInvalidateCacheEntryForGC(
39613962
if (auto* nfsdChannel = getMount()->getNfsdChannel()) {
39623963
const auto path = getPath();
39633964
if (path.has_value()) {
3964-
// The contents lock is held by nfsInvalidateCacheEntryForGC
3965+
// The contents lock is held by invalidateChildrenNotMaterialized
39653966
auto mode = getMetadataLocked(state.entries).mode;
39663967
nfsdChannel->invalidate(
39673968
getMount()->getPath() + *path + name,
@@ -4404,9 +4405,10 @@ ImmediateFuture<uint64_t> TreeInode::invalidateChildrenNotMaterialized(
44044405

44054406
return getLoadedOrRememberedTreeChildren(this, getInodeMap(), context)
44064407
.thenValue([context = context.copy(),
4407-
cutoff](std::vector<TreeInodePtr> treeChildren) {
4408+
cutoff](const std::vector<TreeInodePtr>& treeChildren) {
44084409
std::vector<ImmediateFuture<uint64_t>> futures;
44094410

4411+
futures.reserve(treeChildren.size());
44104412
for (auto& tree : treeChildren) {
44114413
futures.push_back(
44124414
tree->invalidateChildrenNotMaterialized(cutoff, context));

0 commit comments

Comments
 (0)