int blockIndex = BlockInfo.computeBlockIndex(blockId);
synchronized (mRootLock) {
Inode inode = mFileIdToInodes.get(fileId);
if (inode == null) {
throw new FileDoesNotExistException("File " + fileId + " does not exist.");
}
if (inode.isDirectory()) {
throw new FileDoesNotExistException("File " + fileId + " is a folder.");
}
InodeFile tFile = (InodeFile) inode;
if (tFile.getNumberOfBlocks() <= blockIndex) {
addBlock(tFile, new BlockInfo(tFile, blockIndex, length), System.currentTimeMillis());