@Override public void addSpaceConsumed(QuotaCounts counts) { super.addSpaceConsumed(counts); final DirectoryWithQuotaFeature q = getDirectoryWithQuotaFeature(); if (q != null && isQuotaSet()) { q.addSpaceConsumed2Cache(counts); } }
public void updateCount(INodesInPath iip, INode.QuotaDelta quotaDelta, boolean check) throws QuotaExceededException { QuotaCounts counts = quotaDelta.getCountsCopy(); updateCount(iip, iip.length() - 1, counts.negation(), check); Map<INode, QuotaCounts> deltaInOtherPaths = quotaDelta.getUpdateMap(); for (Map.Entry<INode, QuotaCounts> entry : deltaInOtherPaths.entrySet()) { INodesInPath path = INodesInPath.fromINode(entry.getKey()); updateCount(path, path.length() - 1, entry.getValue().negation(), check); } for (Map.Entry<INodeDirectory, QuotaCounts> entry : quotaDelta.getQuotaDirMap().entrySet()) { INodeDirectory quotaDir = entry.getKey(); quotaDir.getDirectoryWithQuotaFeature().addSpaceConsumed2Cache( entry.getValue().negation()); } }
/** * updates quota without verification * callers responsibility is to make sure quota is not exceeded */ static void unprotectedUpdateCount(INodesInPath inodesInPath, int numOfINodes, QuotaCounts counts) { for(int i=0; i < numOfINodes; i++) { if (inodesInPath.getINode(i).isQuotaSet()) { // a directory with quota inodesInPath.getINode(i).asDirectory().getDirectoryWithQuotaFeature() .addSpaceConsumed2Cache(counts); } } }
void addSpaceConsumed(final INodeDirectory dir, final QuotaCounts counts, boolean verify) throws QuotaExceededException { if (dir.isQuotaSet()) { // The following steps are important: // check quotas in this inode and all ancestors before changing counts // so that no change is made if there is any quota violation. // (1) verify quota in this inode if (verify) { verifyQuota(counts); } // (2) verify quota and then add count in ancestors dir.addSpaceConsumed2Parent(counts, verify); // (3) add count in this inode addSpaceConsumed2Cache(counts); } else { dir.addSpaceConsumed2Parent(counts, verify); } }
void addSpaceConsumed(final INodeDirectory dir, final QuotaCounts counts, boolean verify) throws QuotaExceededException { if (dir.isQuotaSet()) { // The following steps are important: // check quotas in this inode and all ancestors before changing counts // so that no change is made if there is any quota violation. // (1) verify quota in this inode if (verify) { verifyQuota(counts); } // (2) verify quota and then add count in ancestors dir.addSpaceConsumed2Parent(counts, verify); // (3) add count in this inode addSpaceConsumed2Cache(counts); } else { dir.addSpaceConsumed2Parent(counts, verify); } }
/** * updates quota without verification * callers responsibility is to make sure quota is not exceeded */ static void unprotectedUpdateCount(INodesInPath inodesInPath, int numOfINodes, QuotaCounts counts) { for(int i=0; i < numOfINodes; i++) { if (inodesInPath.getINode(i).isQuotaSet()) { // a directory with quota inodesInPath.getINode(i).asDirectory().getDirectoryWithQuotaFeature() .addSpaceConsumed2Cache(counts); } } }
/** * updates quota without verification * callers responsibility is to make sure quota is not exceeded */ static void unprotectedUpdateCount(INodesInPath inodesInPath, int numOfINodes, QuotaCounts counts) { for(int i=0; i < numOfINodes; i++) { if (inodesInPath.getINode(i).isQuotaSet()) { // a directory with quota inodesInPath.getINode(i).asDirectory().getDirectoryWithQuotaFeature() .addSpaceConsumed2Cache(counts); } } }
@Override public QuotaCounts cleanSubtree(final BlockStoragePolicySuite bsps, final int snapshotId, int priorSnapshotId, final BlocksMapUpdateInfo collectedBlocks, final List<INode> removedINodes) { DirectoryWithSnapshotFeature sf = getDirectoryWithSnapshotFeature(); // there is snapshot data if (sf != null) { return sf.cleanDirectory(bsps, this, snapshotId, priorSnapshotId, collectedBlocks, removedINodes); } // there is no snapshot data if (priorSnapshotId == Snapshot.NO_SNAPSHOT_ID && snapshotId == Snapshot.CURRENT_STATE_ID) { // destroy the whole subtree and collect blocks that should be deleted QuotaCounts counts = new QuotaCounts.Builder().build(); this.computeQuotaUsage(bsps, counts, true); destroyAndCollectBlocks(bsps, collectedBlocks, removedINodes); return counts; } else { // process recursively down the subtree QuotaCounts counts = cleanSubtreeRecursively(bsps, snapshotId, priorSnapshotId, collectedBlocks, removedINodes, null); if (isQuotaSet()) { getDirectoryWithQuotaFeature().addSpaceConsumed2Cache(counts.negation()); } return counts; } }
@Override public QuotaCounts cleanSubtree(final BlockStoragePolicySuite bsps, final int snapshotId, int priorSnapshotId, final BlocksMapUpdateInfo collectedBlocks, final List<INode> removedINodes) { DirectoryWithSnapshotFeature sf = getDirectoryWithSnapshotFeature(); // there is snapshot data if (sf != null) { return sf.cleanDirectory(bsps, this, snapshotId, priorSnapshotId, collectedBlocks, removedINodes); } // there is no snapshot data if (priorSnapshotId == Snapshot.NO_SNAPSHOT_ID && snapshotId == Snapshot.CURRENT_STATE_ID) { // destroy the whole subtree and collect blocks that should be deleted QuotaCounts counts = new QuotaCounts.Builder().build(); this.computeQuotaUsage(bsps, counts, true); destroyAndCollectBlocks(bsps, collectedBlocks, removedINodes); return counts; } else { // process recursively down the subtree QuotaCounts counts = cleanSubtreeRecursively(bsps, snapshotId, priorSnapshotId, collectedBlocks, removedINodes, null); if (isQuotaSet()) { getDirectoryWithQuotaFeature().addSpaceConsumed2Cache(counts.negation()); } return counts; } }
currentINode.getDirectoryWithQuotaFeature().addSpaceConsumed2Cache( counts.negation());
currentINode.getDirectoryWithQuotaFeature().addSpaceConsumed2Cache( counts.negation());