/** * 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(); } }
/** * See {@link ClientProtocol#setQuota(String, long, long)} for the * contract. * @see #unprotectedSetQuota(String, long, long) */ void setQuota(String src, long nsQuota, long dsQuota) throws FileNotFoundException, QuotaExceededException { synchronized (rootDir) { INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota); if (dir != null) { fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(), dir.getDsQuota()); } } }
/** * Set the namespace, storagespace and typespace quota for a directory. * * Note: This does not support ".inodes" relative path. */ static void setQuota(FSDirectory fsd, String src, long nsQuota, long ssQuota, StorageType type) throws IOException { if (fsd.isPermissionEnabled()) { FSPermissionChecker pc = fsd.getPermissionChecker(); pc.checkSuperuserPrivilege(); } fsd.writeLock(); try { INodeDirectory changed = unprotectedSetQuota(fsd, src, 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(); } }
/** * See {@link ClientProtocol#setQuota(String, long, long)} for the * contract. * @see #unprotectedSetQuota(String, long, long) */ void setQuota(String src, long nsQuota, long dsQuota) throws FileNotFoundException, QuotaExceededException { writeLock(); try { INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota); if (dir != null) { fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(), dir.getDsQuota()); } } finally { writeUnlock(); } }
/** * Set the namespace, storagespace and typespace quota for a directory. * * Note: This does not support ".inodes" relative path. */ static void setQuota(FSDirectory fsd, String src, long nsQuota, long ssQuota, StorageType type) throws IOException { if (fsd.isPermissionEnabled()) { FSPermissionChecker pc = fsd.getPermissionChecker(); pc.checkSuperuserPrivilege(); } fsd.writeLock(); try { INodeDirectory changed = unprotectedSetQuota(fsd, src, 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(); } }