示例#1
0
 File addBlock(Block b, File f) throws IOException {
   File blockDir = DatanodeUtil.idToBlockDir(finalizedDir, b.getBlockId());
   if (!blockDir.exists()) {
     if (!blockDir.mkdirs()) {
       throw new IOException("Failed to mkdirs " + blockDir);
     }
   }
   File blockFile = FsDatasetImpl.moveBlockFiles(b, f, blockDir);
   File metaFile = FsDatasetUtil.getMetaFile(blockFile, b.getGenerationStamp());
   dfsUsage.incDfsUsed(b.getNumBytes() + metaFile.length());
   return blockFile;
 }
示例#2
0
 File createRbwFile(Block b) throws IOException {
   File f = new File(rbwDir, b.getBlockName());
   return DatanodeUtil.createTmpFile(b, f);
 }