Add scatter/gather support to librbd C/C++ APIs
#2 Updated by Jason Dillaman about 3 years ago
Adding new methods to the C API:
rbd_aio_writev(rbd_image_t image, const struct iovec *iov, int iovcnt, uint64_t off, rbd_completion_t c) rbd_aio_readv(rbd_image_t image, const struct iovec *iov, int iovcnt, uint64_t off, rbd_completion_t c)
Internally, all the C API write methods will use a bufferlist created with a static pointer initialized to the provided buffer. From QEMU, this will eliminate the need for the bounce buffer and avoids copying the buffer into a new bufferlist (within librbd::aio_write in internal.cc). A C API write should only involve one copy to store the provided buffer in the cache (if enabled) and a read should only involve one copy to transfer data into the user buffer.
The C++ API already has basic support for scatter/gather via the bufferlist, so the only change I made there was to ensure it was no longer converting the bufferlist to a C-style array. A C++ API read/write should involve zero copies (assuming it's shareable).