mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
cephfs: round to cephfs size to multiple of 4Mib
Due to the bug in the df stat we need to round off the subvolume size to align with 4Mib. Note:- Minimum supported size in cephcsi is 1Mib, we dont need to take care of Kib. fixes #3240 More details at https://github.com/ceph/ceph/pull/46905 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
1856647506
commit
f171143135
@ -58,6 +58,22 @@ func RoundOffBytes(bytes int64) int64 {
|
||||
return num
|
||||
}
|
||||
|
||||
// RoundOffCephFSVolSize rounds up the bytes to 4MiB if the request is less
|
||||
// than 4MiB or if its greater it rounds up to multiple of 4MiB.
|
||||
func RoundOffCephFSVolSize(bytes int64) int64 {
|
||||
// Minimum supported size is 1MiB in CephCSI, if the request is <4MiB,
|
||||
// round off to 4MiB.
|
||||
if bytes < helpers.MiB {
|
||||
return 4 * helpers.MiB
|
||||
}
|
||||
|
||||
bytes /= helpers.MiB
|
||||
|
||||
bytes = int64(math.Ceil(float64(bytes)/4) * 4)
|
||||
|
||||
return RoundOffBytes(bytes * helpers.MiB)
|
||||
}
|
||||
|
||||
// variables which will be set during the build time.
|
||||
var (
|
||||
// GitCommit tell the latest git commit image is built from.
|
||||
|
Reference in New Issue
Block a user