ssize_t rbd_write2(rbd_image_t image, uint64_t ofs, size_t len,
const char *buf, int op_flags)
int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len)
+ int rbd_write_zeroes(rbd_image_t image, uint64_t ofs, uint64_t len,
+ int zero_flags, int op_flags)
int rbd_copy3(rbd_image_t src, rados_ioctx_t dest_io_ctx,
const char *destname, rbd_image_options_t dest_opts)
int rbd_deep_copy(rbd_image_t src, rados_ioctx_t dest_io_ctx,
char *buf, rbd_completion_t c, int op_flags)
int rbd_aio_discard(rbd_image_t image, uint64_t off, uint64_t len,
rbd_completion_t c)
+ int rbd_aio_write_zeroes(rbd_image_t image, uint64_t off, uint64_t len,
+ rbd_completion_t c, int zero_flags, int op_flags)
int rbd_aio_create_completion(void *cb_arg, rbd_callback_t complete_cb,
rbd_completion_t *c)
msg = 'error discarding region %d~%d' % (offset, length)
raise make_ex(ret, msg)
+ @requires_not_closed
+ def write_zeroes(self, offset, length, zero_flags = 0):
+ """
+ Zero the range from the image. By default it will attempt to
+ discard/unmap as much space as possible but any unaligned
+ extent segments will still be zeroed.
+ """
+ cdef:
+ uint64_t _offset = offset, _length = length
+ int _zero_flags = zero_flags
+ with nogil:
+ ret = rbd_write_zeroes(self.image, _offset, _length,
+ _zero_flags, 0)
+ if ret < 0:
+ msg = 'error zeroing region %d~%d' % (offset, length)
+ raise make_ex(ret, msg)
+
@requires_not_closed
def flush(self):
"""
return completion
+ @requires_not_closed
+ def aio_write_zeroes(self, offset, length, oncomplete, zero_flags = 0):
+ """
+ Asynchronously Zero the range from the image. By default it will attempt
+ to discard/unmap as much space as possible but any unaligned extent
+ segments will still be zeroed.
+ """
+ cdef:
+ uint64_t _offset = offset
+ size_t _length = length
+ int _zero_flags = zero_flags
+ Completion completion
+
+ completion = self.__get_completion(oncomplete)
+ try:
+ completion.__persist()
+ with nogil:
+ ret = rbd_aio_write_zeroes(self.image, _offset, _length,
+ completion.rbd_comp, _zero_flags, 0)
+ if ret < 0:
+ raise make_ex(ret, 'error zeroing %s %ld~%ld' %
+ (self.name, offset, length))
+ except:
+ completion.__unpersist()
+ raise
+
+ return completion
+
@requires_not_closed
def aio_flush(self, oncomplete):
"""