mohan3d commented on code in PR #4226:
URL: https://github.com/apache/ozone/pull/4226#discussion_r1096483747


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java:
##########
@@ -1010,6 +1013,24 @@ listingPageSize, uri, workingDir, getUsername())
     return statusList;
   }
 
+  @Override
+  public FsStatus getStatus(Path p) throws IOException {
+    BasicOzoneClientAdapterImpl adapterImpl =
+        (BasicOzoneClientAdapterImpl) adapter;
+    OzoneBucket bucket = adapterImpl.getBucket();
+    long usedBytes = bucket.getUsedBytes();
+    long quota = Long.MAX_VALUE;
+    if (bucket.getQuotaInBytes() > -1) {
+      quota = bucket.getQuotaInBytes();
+    } else {
+      OzoneVolume volume = adapterImpl.getVolume();
+      if (volume.getQuotaInBytes() > -1) {
+        quota = volume.getQuotaInBytes();

Review Comment:
   Thanks again @sadanand48 , this way the calculations is reduced to:
   if bucket has quota set: return (bucket.quota, bucket.usedBytes, quota - 
usedBytes)
   else if (volume has quota set): return (volume.quota, volume.usedBytes, 
quota - usedBytes)
   else: return (Long.MAX_VALUE, bucket.usedBytes, Long.MAX_VALUE - usedBytes)
   
   Please look into last case where there is no quota set for both volume and 
bucket. does this make sense or return default values  (Long.MAX_VALUE, 0, 
Long.MAX_VALUE).
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to