Beispiel #1
0
 /**
  * Collect all the blocks at this INode and all its children. This operation is performed after
  * a node is removed from the tree, and we want to GC all the blocks at this node and below.
  */
 void collectSubtreeBlocks(Vector v) {
   if (blocks != null) {
     for (int i = 0; i < blocks.length; i++) {
       v.add(blocks[i]);
     }
   }
   for (Iterator it = children.values().iterator(); it.hasNext(); ) {
     INode child = (INode) it.next();
     child.collectSubtreeBlocks(v);
   }
 }
Beispiel #2
0
 Block[] unprotectedDelete(UTF8 src) {
   synchronized (rootDir) {
     INode targetNode = rootDir.getNode(src.toString());
     if (targetNode == null) {
       return null;
     } else {
       //
       // Remove the node from the namespace and GC all
       // the blocks underneath the node.
       //
       if (!targetNode.removeNode()) {
         return null;
       } else {
         Vector v = new Vector();
         targetNode.collectSubtreeBlocks(v);
         for (Iterator it = v.iterator(); it.hasNext(); ) {
           Block b = (Block) it.next();
           activeBlocks.remove(b);
         }
         return (Block[]) v.toArray(new Block[v.size()]);
       }
     }
   }
 }