disk_common.go 424 B

1234567891011121314151617
  1. package stats
  2. import "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
  3. func calculateDiskRemaining(disk *volume_server_pb.DiskStatus) {
  4. disk.Used = disk.All - disk.Free
  5. if disk.All > 0 {
  6. disk.PercentFree = float32((float64(disk.Free) / float64(disk.All)) * 100)
  7. disk.PercentUsed = float32((float64(disk.Used) / float64(disk.All)) * 100)
  8. } else {
  9. disk.PercentFree = 0
  10. disk.PercentUsed = 0
  11. }
  12. return
  13. }