forked from topolvm/topolvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request topolvm#961 from topolvm/lvmd/use-0-as-free-bytes-…
…of-thin-pool-if-usage-exceeds-total-capacity fix: lvmd: use 0 as free bytes of thin pool if usage exceeds total capacity
- Loading branch information
Showing
3 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package lvmd | ||
|
||
import "math" | ||
|
||
func calcThinPoolFreeBytes(overProvisionRatio float64, tpuSizeBytes, tpuVirtualBytes uint64) uint64 { | ||
virtualPoolSize := uint64(math.Floor(overProvisionRatio * float64(tpuSizeBytes))) | ||
if virtualPoolSize <= tpuVirtualBytes { | ||
return 0 | ||
} | ||
return virtualPoolSize - tpuVirtualBytes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters