public long getDirectoryCount() { return contents.get(Content.DIRECTORY); }
public long getSnapshotCount() { return contents.get(Content.SNAPSHOT); }
public long getTypeSpace(StorageType t) { return types.get(t); }
public long getSymlinkCount() { return contents.get(Content.SYMLINK); }
public long getStoragespace() { return contents.get(Content.DISKSPACE); }
public long getStorageSpace(){ return nsSsCounts.get(Quota.STORAGESPACE); }
long getTypeSpace(StorageType type) { return this.tsCounts.get(type); }
public long getFileCount() { return contents.get(Content.FILE); }
public long getLength() { return contents.get(Content.LENGTH); }
public long getSnapshotableDirectoryCount() { return contents.get(Content.SNAPSHOTTABLE_DIRECTORY); }
public long getNameSpace(){ return nsSsCounts.get(Quota.NAMESPACE); }
/** Decrement the number of blocks scheduled. */ void decrementBlocksScheduled(StorageType t) { if (prevApproxBlocksScheduled.get(t) > 0) { prevApproxBlocksScheduled.subtract(t, 1); } else if (currApproxBlocksScheduled.get(t) > 0) { currApproxBlocksScheduled.subtract(t, 1); } // its ok if both counters are zero. }
private void verifyQuotaByStorageType(EnumCounters<StorageType> typeDelta) throws QuotaByStorageTypeExceededException { if (!isQuotaByStorageTypeSet()) { return; } for (StorageType t: StorageType.getTypesSupportingQuota()) { if (!isQuotaByStorageTypeSet(t)) { continue; } if (Quota.isViolated(quota.getTypeSpace(t), usage.getTypeSpace(t), typeDelta.get(t))) { throw new QuotaByStorageTypeExceededException( quota.getTypeSpace(t), usage.getTypeSpace(t) + typeDelta.get(t), t); } } }
if (oldTypeQuotas != null && oldTypeQuotas.get(type) == ssQuota) { return null;
/** Decrement the number of blocks scheduled. */ void decrementBlocksScheduled(StorageType t) { if (prevApproxBlocksScheduled.get(t) > 0) { prevApproxBlocksScheduled.subtract(t, 1); } else if (currApproxBlocksScheduled.get(t) > 0) { currApproxBlocksScheduled.subtract(t, 1); } // its ok if both counters are zero. }
/** * Set the namespace, storagespace and typespace quota for a directory. * * Note: This does not support ".inodes" relative path. */ static void setQuota(FSDirectory fsd, FSPermissionChecker pc, String src, long nsQuota, long ssQuota, StorageType type) throws IOException { if (fsd.isPermissionEnabled()) { pc.checkSuperuserPrivilege(); } fsd.writeLock(); try { INodesInPath iip = fsd.resolvePath(pc, src, DirOp.WRITE); INodeDirectory changed = unprotectedSetQuota(fsd, iip, nsQuota, ssQuota, type); if (changed != null) { final QuotaCounts q = changed.getQuotaCounts(); if (type == null) { fsd.getEditLog().logSetQuota(src, q.getNameSpace(), q.getStorageSpace()); } else { fsd.getEditLog().logSetQuotaByStorageType( src, q.getTypeSpaces().get(type), type); } } } finally { fsd.writeUnlock(); } }