Skip to content

Commit

Permalink
calculate total available as available + used
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Feb 10, 2021
1 parent 0c6c3d4 commit d080ab3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/storage/fs/ocis/ocis.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,12 @@ func (fs *ocisfs) GetQuota(ctx context.Context) (uint64, uint64, error) {
return 0, 0, err
}

total := stat.Blocks * uint64(stat.Bsize) // Total data blocks in filesystem
total := +ri.Size + (stat.Bavail * uint64(stat.Bsize)) // used treesize + available space

switch {
case quotaStr == _quotaUncalculated, quotaStr == _quotaUnknown, quotaStr == _quotaUnlimited:
// best we can do is return current total
// TODO indicate unlimited total?
// TODO indicate unlimited total? -> in opaque data?
default:
if quota, err := strconv.ParseUint(quotaStr, 10, 64); err == nil {
if total > quota {
Expand Down

0 comments on commit d080ab3

Please sign in to comment.