cfs/src/FsProc_FileMngOps.cc
// NOTE: Helper function only called by ModifyDirEntries.
Helper function only called by ModifyDirEntries.
Helper function only called by ModifyDirEntries .
void FileMng::RenameOp::ModifyDstDirHelper(FileMng *mng, FsReq *req,
                                           InMemInode *src_dir_inode,
                                           InMemInode *src_inode,
                                           InMemInode *dst_dir_inode,
                                           InMemInode *dst_inode) {
  if (!req->isDstExist()) {
    mng->fsImpl_->appendToDir(req, dst_dir_inode, src_inode,
                              req->getNewLeafName());
    if (req->numTotalPendingIoReq() != 0) {
      return;
    }
    dst_dir_inode->adjustDentryCount(1);
    mng->fsImpl_->addSecondPathInodeCacheItem(req, src_inode);
    return;
  }
  int rt = mng->fsImpl_->dentryPointToNewInode(
      req, dst_inode, src_inode, dst_dir_inode, req->getNewLeafName());
  assert(rt == 0);
  auto pos_pair = dst_inode->getDentryDataBlockPosition(dst_dir_inode,
                                                        req->getNewLeafName());
  assert(pos_pair != nullptr);
  auto [dentry_block, dentry_idx] = *pos_pair;
  src_inode->addDentryDataBlockPosition(dst_dir_inode, req->getNewLeafName(),
                                        dentry_block, dentry_idx);
  dst_inode->delDentryDataBlockPosition(dst_dir_inode, req->getNewLeafName());
  FsPermission::MapEntry dum;
  mng->fsImpl_->removeSecondPathInodeCacheItem(req, &dum);
  mng->fsImpl_->permission->RegisterGC(dum.first);
  mng->fsImpl_->addSecondPathInodeCacheItem(req, src_inode);
}
void FileMng :: RenameOp :: ModifyDstDirHelper ( FileMng * mng , FsReq * req , InMemInode * src_dir_inode , InMemInode * src_inode , InMemInode * dst_dir_inode , InMemInode * dst_inode ) { if ( ! req -> isDstExist ( ) ) { mng -> fsImpl_ -> appendToDir ( req , dst_dir_inode , src_inode , req -> getNewLeafName ( ) ) ; if ( req -> numTotalPendingIoReq ( ) != 0 ) { return ; } dst_dir_inode -> adjustDentryCount ( 1 ) ; mng -> fsImpl_ -> addSecondPathInodeCacheItem ( req , src_inode ) ; return ; } int rt = mng -> fsImpl_ -> dentryPointToNewInode ( req , dst_inode , src_inode , dst_dir_inode , req -> getNewLeafName ( ) ) ; assert ( rt == 0 ) ; auto pos_pair = dst_inode -> getDentryDataBlockPosition ( dst_dir_inode , req -> getNewLeafName ( ) ) ; assert ( pos_pair != nullptr ) ; auto [ dentry_block , dentry_idx ] = * pos_pair ; src_inode -> addDentryDataBlockPosition ( dst_dir_inode , req -> getNewLeafName ( ) , dentry_block , dentry_idx ) ; dst_inode -> delDentryDataBlockPosition ( dst_dir_inode , req -> getNewLeafName ( ) ) ; FsPermission :: MapEntry dum ; mng -> fsImpl_ -> removeSecondPathInodeCacheItem ( req , & dum ) ; mng -> fsImpl_ -> permission -> RegisterGC ( dum . first ) ; mng -> fsImpl_ -> addSecondPathInodeCacheItem ( req , src_inode ) ; }
NOTE: Helper function only called by ModifyDirEntries.
NOTE : Helper function only called by ModifyDirEntries .
// dst exists // The existing inode (dst_inode) would have the new name position cached. We // need to copy that into the inode that is replacing it.