ceph-csi/vendor/github.com/ceph/go-ceph/rados/ioctx_pool_alignment.go
Humble Chirammal 483181aec2 rebase: use v1.17.0 of go-ceph library
new version of go ceph is available and this commit make use
of the same.
Ref # https://github.com/ceph/go-ceph/releases/tag/v0.17.0

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2022-08-18 11:42:57 +00:00

28 lines
789 B
Go

//go:build ceph_preview
// +build ceph_preview
package rados
// #cgo LDFLAGS: -lrados
// #include <rados/librados.h>
// #include <stdlib.h>
//
import "C"
// Alignment returns the required stripe size in bytes for pools supporting/requiring it, or an error if unsuccessful.
// For an EC pool, a buffer size multiple of its stripe size is required to call Append. To know if the pool requires
// alignment or not, use RequiresAlignment.
//
// Implements:
// int rados_ioctx_pool_required_alignment2(rados_ioctx_t io, uint64_t *alignment)
func (ioctx *IOContext) Alignment() (uint64, error) {
var alignSizeBytes C.uint64_t
ret := C.rados_ioctx_pool_required_alignment2(
ioctx.ioctx,
&alignSizeBytes)
if ret != 0 {
return 0, getError(ret)
}
return uint64(alignSizeBytes), nil
}