private void verifyQuota ( INode [ ] inodes , int nsQuotaStartPos , int dsQuotaStartPos , int endPos , long nsDelta , long dsDelta ) throws QuotaExceededException { if ( ! ready ) { // Do not check quota if edits log is still being processed return ; } if ( endPos > inodes . length ) { endPos = inodes . length ; } int i = endPos - 1 ; Assert . assertTrue ( "nsQuotaStartPos shall be less or equal than the dsQuotaStartPos" , ( nsQuotaStartPos <= dsQuotaStartPos ) ) ; try { // check existing components in the path for ( ; i >= nsQuotaStartPos ; i -- ) { if ( inodes [ i ] . isQuotaSet ( ) ) { // a directory with quota INodeDirectoryWithQuota node = ( INodeDirectoryWithQuota ) inodes [ i ] ; if ( i >= dsQuotaStartPos ) { // Verify both nsQuota and dsQuota node . verifyQuota ( nsDelta , dsDelta ) ; } else { // Verify the nsQuota only node . verifyQuota ( nsDelta , 0 ) ; } } } } catch ( QuotaExceededException e ) { e . setPathName ( getFullPathName ( inodes , i ) ) ; throw e ; } }
Verify quota for adding or moving a new INode with required namespace and diskspace to a given position .