INodeDirectory addToParent ( byte [ ] src , INodeDirectory parentINode , INode newNode , boolean propagateModTime , int childIndex ) { // NOTE: This does not update space counts for parents // add new node to the parent INodeDirectory newParent = null ; writeLock ( ) ; try { try { newParent = rootDir . addToParent ( src , newNode , parentINode , false , propagateModTime , childIndex ) ; cacheName ( newNode ) ; } catch ( FileNotFoundException e ) { return null ; } if ( newParent == null ) return null ; if ( ! newNode . isDirectory ( ) ) { // Add block->file mapping INodeFile newF = ( INodeFile ) newNode ; BlockInfo [ ] blocks = newF . getBlocks ( ) ; for ( int i = 0 ; i < blocks . length ; i ++ ) { newF . setBlock ( i , getFSNamesystem ( ) . blocksMap . addINodeForLoading ( blocks [ i ] , newF ) ) ; } } } finally { writeUnlock ( ) ; } return newParent ; }
Add node to parent node when loading the image .