mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
SetPathObjectId should avoid mount-wise operations
Reviewed By: chadaustin Differential Revision: D35104663 fbshipit-source-id: 0dd00e3a1a3f8af9869b7eca459bb622cab66992
This commit is contained in:
parent
8c84ec8c2c
commit
ffab8acc6a
@ -85,6 +85,10 @@ Future<vector<CheckoutConflict>> CheckoutContext::finish(RootId newSnapshot) {
|
||||
// This allows any filesystem unlink() or rename() operations to proceed.
|
||||
renameLock_.unlock();
|
||||
|
||||
return flush();
|
||||
}
|
||||
|
||||
Future<vector<CheckoutConflict>> CheckoutContext::flush() {
|
||||
if (!isDryRun()) {
|
||||
// If we have a FUSE channel, flush all invalidations we sent to the kernel
|
||||
// as part of the checkout operation. This will ensure that other processes
|
||||
|
@ -96,6 +96,13 @@ class CheckoutContext {
|
||||
*/
|
||||
folly::Future<std::vector<CheckoutConflict>> finish(RootId newSnapshot);
|
||||
|
||||
/**
|
||||
* Flush the invalidation if needed.
|
||||
*
|
||||
* Return the list of conflicts and errors.
|
||||
*/
|
||||
folly::Future<std::vector<CheckoutConflict>> flush();
|
||||
|
||||
void addConflict(ConflictType type, RelativePathPiece path);
|
||||
void
|
||||
addConflict(ConflictType type, TreeInode* parent, PathComponentPiece name);
|
||||
|
@ -692,20 +692,17 @@ folly::Future<SetPathObjectIdResultAndTimes> EdenMount::setPathObjectId(
|
||||
});
|
||||
|
||||
return collectSafe(getTargetTreeInodeFuture, getRootTreeFuture)
|
||||
.thenValue([this, ctx, setPathObjectIdTime, stopWatch, rootId](
|
||||
.thenValue([ctx, setPathObjectIdTime, stopWatch, rootId](
|
||||
std::tuple<TreeInodePtr, shared_ptr<const Tree>> results) {
|
||||
setPathObjectIdTime->didLookupTreesOrGetInodeByPath =
|
||||
stopWatch.elapsed();
|
||||
auto [targetTreeInode, incomingTree] = results;
|
||||
targetTreeInode->unloadChildrenUnreferencedByFs();
|
||||
// TODO(@yipu): Remove rename lock
|
||||
ctx->start(this->acquireRenameLock(), {}, rootId, nullptr);
|
||||
setPathObjectIdTime->didAcquireRenameLock = stopWatch.elapsed();
|
||||
return targetTreeInode->checkout(ctx.get(), nullptr, incomingTree);
|
||||
})
|
||||
.thenValue([ctx, setPathObjectIdTime, stopWatch, rootId](auto&&) {
|
||||
setPathObjectIdTime->didCheckout = stopWatch.elapsed();
|
||||
return ctx->finish(rootId);
|
||||
return ctx->flush();
|
||||
})
|
||||
.thenValue([ctx, setPathObjectIdTime, stopWatch](
|
||||
std::vector<CheckoutConflict>&& conflicts) {
|
||||
|
@ -164,7 +164,6 @@ struct CheckoutTimes {
|
||||
struct SetPathObjectIdTimes {
|
||||
using duration = std::chrono::steady_clock::duration;
|
||||
duration didLookupTreesOrGetInodeByPath{};
|
||||
duration didAcquireRenameLock{};
|
||||
duration didCheckout{};
|
||||
duration didFinish{};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user