cfs/src/FsProc_FileMngOps.cc
// Once we read the directory inode, we need to find the inode number for the
// given name. The directory data pages may need to be read for this.
Once we read the directory inode, we need to find the inode number for the
given name. The directory data pages may need to be read for this.
Once we read the directory inode we need to find the inode number for the given name . The directory data pages may need to be read for this .
void FileMng::UnlinkOp::PrimaryGetFileInum(FileMng *mng, FsReq *req) {
  assert(mng->fsWorker_->isMasterWorker());
  assert(req->getState() == FsReqState::UNLINK_PRIMARY_GET_FILE_INUM);
  InMemInode *dirInode = req->getDirInode();
  assert(dirInode != nullptr);
  auto target_inode = req->getTargetInode();
  if (target_inode != nullptr) {
    req->setFileIno(target_inode->i_no);
    req->setState(FsReqState::UNLINK_PRIMARY_REMOVE_DENTRY);
    return;
  }
  bool is_err = false;
  uint32_t fileIno =
      mng->fsImpl_->lookupDir(req, dirInode, req->getLeafName(), is_err);
  if (is_err) {
    req->setState(FsReqState::UNLINK_ERR);
    return;
  }
  if (fileIno > 0) {
    req->setFileIno(fileIno);
    req->setState(FsReqState::UNLINK_PRIMARY_LOAD_INODE);
  }
  if (req->numTotalPendingIoReq() != 0) {
    assert(fileIno == 0);
    mng->submitFsGeneratedRequests(req);
  }
}
void FileMng :: UnlinkOp :: PrimaryGetFileInum ( FileMng * mng , FsReq * req ) { assert ( mng -> fsWorker_ -> isMasterWorker ( ) ) ; assert ( req -> getState ( ) == FsReqState :: UNLINK_PRIMARY_GET_FILE_INUM ) ; InMemInode * dirInode = req -> getDirInode ( ) ; assert ( dirInode != nullptr ) ; auto target_inode = req -> getTargetInode ( ) ; if ( target_inode != nullptr ) { req -> setFileIno ( target_inode -> i_no ) ; req -> setState ( FsReqState :: UNLINK_PRIMARY_REMOVE_DENTRY ) ; return ; } bool is_err = false ; uint32_t fileIno = mng -> fsImpl_ -> lookupDir ( req , dirInode , req -> getLeafName ( ) , is_err ) ; if ( is_err ) { req -> setState ( FsReqState :: UNLINK_ERR ) ; return ; } if ( fileIno > 0 ) { req -> setFileIno ( fileIno ) ; req -> setState ( FsReqState :: UNLINK_PRIMARY_LOAD_INODE ) ; } if ( req -> numTotalPendingIoReq ( ) != 0 ) { assert ( fileIno == 0 ) ; mng -> submitFsGeneratedRequests ( req ) ; } }
Once we read the directory inode, we need to find the inode number for the
given name.
Once we read the directory inode we need to find the inode number for the given name .