Skip to content

Commit

Permalink
cephfs: save space in the cluster by avoiding roundoff
Browse files Browse the repository at this point in the history
CephFS controller round off ( by util.RoundOffBytes) on the size
passed in from the provisioner at present, however this can
cause wastage of space in the cluster. The CephFS filesystem is
capable of creating volume with the exact size passed in. so no
need of Roundoff here before we reach out to the cluster

```
$ ceph fs subvolume create <vol_name> <subvol_name> [--size
<size_in_bytes>]...
```

Clone scenario:

This shouldnt be an issue as cephfs keep the parent size while the
clone is performed, we also have an extra measure at clone to make
the requested size is achieved by resize if the backend is not
having the requested size. This shouldnt be a case falling into with
this patch though.

Signed-off-by: Humble Chirammal <[email protected]>
  • Loading branch information
humblec committed Sep 14, 2021
1 parent 4be53a2 commit 9238207
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/cephfs/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ func (cs *ControllerServer) CreateVolume(
defer volOptions.Destroy()

if req.GetCapacityRange() != nil {
volOptions.Size = util.RoundOffBytes(req.GetCapacityRange().GetRequiredBytes())
// we were doing round off ( by util.RoundOffBytes) to the size passed
// in from the provisioner before ceph csi v3.4.0, however this can
// cause wastage of space in the cluster. The CephFS filesystem is capable
// of creating volume with the exact size passed in. so no need of Roundoff
// here before we reach out to the cluster
volOptions.Size = req.GetCapacityRange().GetRequiredBytes()
}

parentVol, pvID, sID, err := checkContentSource(ctx, req, cr)
Expand Down

0 comments on commit 9238207

Please sign in to comment.