eden/fs/inodes/TreeInode.cpp
/* If we don't yet have an overlay entry for this portion of the tree,
 * populate it from the Tree.  In order to materialize a dir we have
 * to also materialize its parents. */
If we don't yet have an overlay entry for this portion of the tree,
populate it from the Tree.  In order to materialize a dir we have
to also materialize its parents.
If we don ' t yet have an overlay entry for this portion of the tree populate it from the Tree . In order to materialize a dir we have to also materialize its parents .
void TreeInode::childMaterialized(
    const RenameLock& renameLock,
    PathComponentPiece childName) {
  {
    auto contents = contents_.wlock();
    auto iter = contents->entries.find(childName);
    if (iter == contents->entries.end()) {
      EDEN_BUG() << "error attempting to materialize " << childName << " in "
                 << getLogPath() << ": entry not present";
    }
    auto& childEntry = iter->second;
    if (contents->isMaterialized() && childEntry.isMaterialized()) {
      return;
    }
    childEntry.setMaterialized();
    contents->setMaterialized();
    saveOverlayDir(contents->entries);
  }
  auto location = getLocationInfo(renameLock);
  if (location.parent && !location.unlinked) {
    location.parent->childMaterialized(renameLock, location.name);
  }
}
void TreeInode :: childMaterialized ( const RenameLock & renameLock , PathComponentPiece childName ) { { auto contents = contents_ . wlock ( ) ; auto iter = contents -> entries . find ( childName ) ; if ( iter == contents -> entries . end ( ) ) { EDEN_BUG ( ) << " " << childName << " " << getLogPath ( ) << " " ; } auto & childEntry = iter -> second ; if ( contents -> isMaterialized ( ) && childEntry . isMaterialized ( ) ) { return ; } childEntry . setMaterialized ( ) ; contents -> setMaterialized ( ) ; saveOverlayDir ( contents -> entries ) ; } auto location = getLocationInfo ( renameLock ) ; if ( location . parent && ! location . unlinked ) { location . parent -> childMaterialized ( renameLock , location . name ) ; } }
If we don't yet have an overlay entry for this portion of the tree,
 populate it from the Tree.
If we don ' t yet have an overlay entry for this portion of the tree populate it from the Tree .
// This should never happen. // We should only get called with legitimate children names. // Nothing to do // If we have a parent directory, ask our parent to materialize itself // and mark us materialized when it does so.