symious commented on code in PR #7927:
URL: https://github.com/apache/ozone/pull/7927#discussion_r1967145950


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java:
##########
@@ -68,23 +68,24 @@ SpaceUsageSource realUsage() {
   /**
    * <pre>
    * {@code
-   * Calculate available space use method B.
-   * |----used----|   (avail)   |++++++++reserved++++++++|
-   *              |     fsAvail      |-------other-------|
-   *                          -&gt;|~~~~|&lt;-
-   *                      remainingReserved
+   * Calculate available space.
+   * |----used----|                 fsFree                 |
+   * |----used----|          fsAvail           |---other---|
+   * |----used----|   (avail)   |+++reserved+++|---other---|
+   * |<-                    fsCapacity                   ->|
+   * |<-           usableCapacity            ->|
+   * |<-       capacity      ->|
    * }
    * </pre>
-   * B) avail = fsAvail - Max(reserved - other, 0);
+   * capacity = max(usableCapacity - reserved, 0);
+   * avail = max(fsAvail - reserved, 0);
    */
   public SpaceUsageSource getCurrentUsage() {
     SpaceUsageSource real = realUsage();
 
-    return reservedInBytes == 0
-        ? real
-        : new SpaceUsageSource.Fixed(
-            Math.max(real.getCapacity() - reservedInBytes, 0),
-            Math.max(real.getAvailable() - getRemainingReserved(real), 0),
+    return new SpaceUsageSource.Fixed(
+            Math.max(getUsableCapacity(real) - reservedInBytes, 0),
+            Math.max(real.getAvailable() - reservedInBytes, 0),
             real.getUsedSpace());

Review Comment:
   @adoroszlai The logic is updated, PTAL.



-- 
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