bdev/rbd: Save comp varaible in bdev_io structure
Purpose: Better to put this varable into the bdev_rbd_io structure instead of on the stack. And we will use this variable in next patch, when the callback function is completed, so we should not put it on the stack. Change-Id: I11ff46ef07908084012bc1ce040eceb667334a40 Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9334 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
70e2e5d94b
commit
0d90cda0be
@ -95,6 +95,7 @@ struct bdev_rbd_io_channel {
|
||||
struct bdev_rbd_io {
|
||||
struct spdk_thread *submit_td;
|
||||
enum spdk_bdev_io_status status;
|
||||
rbd_completion_t comp;
|
||||
size_t total_len;
|
||||
};
|
||||
|
||||
@ -412,36 +413,34 @@ bdev_rbd_start_aio(struct bdev_rbd *disk, struct spdk_bdev_io *bdev_io,
|
||||
struct iovec *iov, int iovcnt, uint64_t offset, size_t len)
|
||||
{
|
||||
int ret;
|
||||
rbd_completion_t comp;
|
||||
struct bdev_rbd_io *rbd_io;
|
||||
struct bdev_rbd_io *rbd_io = (struct bdev_rbd_io *)bdev_io->driver_ctx;
|
||||
rbd_image_t image = disk->image;
|
||||
|
||||
ret = rbd_aio_create_completion(bdev_io, bdev_rbd_finish_aiocb,
|
||||
&comp);
|
||||
&rbd_io->comp);
|
||||
if (ret < 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
|
||||
rbd_io = (struct bdev_rbd_io *)bdev_io->driver_ctx;
|
||||
rbd_io->total_len = len;
|
||||
if (spdk_likely(iovcnt == 1)) {
|
||||
ret = rbd_aio_read(image, offset, iov[0].iov_len, iov[0].iov_base, comp);
|
||||
ret = rbd_aio_read(image, offset, iov[0].iov_len, iov[0].iov_base, rbd_io->comp);
|
||||
} else {
|
||||
ret = rbd_aio_readv(image, iov, iovcnt, offset, comp);
|
||||
ret = rbd_aio_readv(image, iov, iovcnt, offset, rbd_io->comp);
|
||||
}
|
||||
} else if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) {
|
||||
if (spdk_likely(iovcnt == 1)) {
|
||||
ret = rbd_aio_write(image, offset, iov[0].iov_len, iov[0].iov_base, comp);
|
||||
ret = rbd_aio_write(image, offset, iov[0].iov_len, iov[0].iov_base, rbd_io->comp);
|
||||
} else {
|
||||
ret = rbd_aio_writev(image, iov, iovcnt, offset, comp);
|
||||
ret = rbd_aio_writev(image, iov, iovcnt, offset, rbd_io->comp);
|
||||
}
|
||||
} else if (bdev_io->type == SPDK_BDEV_IO_TYPE_FLUSH) {
|
||||
ret = rbd_aio_flush(image, comp);
|
||||
ret = rbd_aio_flush(image, rbd_io->comp);
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
rbd_aio_release(comp);
|
||||
rbd_aio_release(rbd_io->comp);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user