@Override
  boolean removeStorage(DatanodeStorageInfo storage) {
    int dnIndex = findStorageInfoFromEnd(storage);
    if (dnIndex < 0) { // the node is not found
      return false;
    }
    assert getPrevious(dnIndex) == null && getNext(dnIndex) == null :
        "Block is still in the list and must be removed first.";
    // set the triplet to null
    setStorageInfo(dnIndex, null);
    setNext(dnIndex, null);
    setPrevious(dnIndex, null);
    indices[dnIndex] = -1;
    return true;
  }
@Test
  public void testGetBlockInfo() throws IllegalArgumentException, Exception {
    int dataBlocks = testECPolicy.getNumDataUnits();
    int parityBlocks = testECPolicy.getNumParityUnits();
    int totalSize = dataBlocks + parityBlocks;
    File builderBaseDir = new File(GenericTestUtils.getRandomizedTempPath());
    Configuration conf = new Configuration();
    try (MiniDFSCluster cluster =
        new MiniDFSCluster.Builder(conf, builderBaseDir).numDataNodes(totalSize)
            .build()) {
      DistributedFileSystem fs = cluster.getFileSystem();
      fs.enableErasureCodingPolicy(
          StripedFileTestUtil.getDefaultECPolicy().getName());
      fs.enableErasureCodingPolicy(testECPolicy.getName());
      fs.mkdirs(new Path("/ecDir"));
      fs.setErasureCodingPolicy(new Path("/ecDir"), testECPolicy.getName());
      DFSTestUtil.createFile(fs, new Path("/ecDir/ecFile"),
          fs.getDefaultBlockSize() * dataBlocks, (short) 1, 1024);
      ExtendedBlock blk = DFSTestUtil
          .getAllBlocks(fs, new Path("/ecDir/ecFile")).get(0).getBlock();
      String id = "blk_" + Long.toString(blk.getBlockId());
      BlockInfo bInfo = cluster.getNameNode().getNamesystem().getBlockManager()
          .getStoredBlock(blk.getLocalBlock());
      DatanodeStorageInfo[] dnStorageInfo = cluster.getNameNode()
          .getNamesystem().getBlockManager().getStorages(bInfo);
      bInfo.removeStorage(dnStorageInfo[1]);
      ByteArrayOutputStream bStream = new ByteArrayOutputStream();
      PrintStream out = new PrintStream(bStream, true);
      assertEquals(0, ToolRunner.run(new DFSck(conf, out), new String[] {
          new Path("/ecDir/ecFile").toString(), "-blockId", id }));
      assertFalse(out.toString().contains("null"));
    }
  }