bdev: save the bdev_desc specified when submitting the I/O

This will be needed for using this same descriptor when
splitting an I/O.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idec759df7ab27f8de567d3c8a4214e25dbe173f5

Reviewed-on: https://review.gerrithub.io/423022
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2018-08-17 15:06:26 -07:00
parent da01835d84
commit 9f2dd0c4f8
2 changed files with 14 additions and 0 deletions

View File

@ -401,6 +401,9 @@ struct spdk_bdev_io {
/** The bdev I/O channel that this was submitted on. */ /** The bdev I/O channel that this was submitted on. */
struct spdk_bdev_channel *io_submit_ch; struct spdk_bdev_channel *io_submit_ch;
/** The bdev descriptor that was used when submitting this I/O. */
struct spdk_bdev_desc *desc;
/** User function that will be called when this completes */ /** User function that will be called when this completes */
spdk_bdev_io_completion_cb cb; spdk_bdev_io_completion_cb cb;

View File

@ -1822,6 +1822,7 @@ spdk_bdev_read_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_READ; bdev_io->type = SPDK_BDEV_IO_TYPE_READ;
bdev_io->u.bdev.iovs = &bdev_io->iov; bdev_io->u.bdev.iovs = &bdev_io->iov;
bdev_io->u.bdev.iovs[0].iov_base = buf; bdev_io->u.bdev.iovs[0].iov_base = buf;
@ -1869,6 +1870,7 @@ int spdk_bdev_readv_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_READ; bdev_io->type = SPDK_BDEV_IO_TYPE_READ;
bdev_io->u.bdev.iovs = iov; bdev_io->u.bdev.iovs = iov;
bdev_io->u.bdev.iovcnt = iovcnt; bdev_io->u.bdev.iovcnt = iovcnt;
@ -1917,6 +1919,7 @@ spdk_bdev_write_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE; bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE;
bdev_io->u.bdev.iovs = &bdev_io->iov; bdev_io->u.bdev.iovs = &bdev_io->iov;
bdev_io->u.bdev.iovs[0].iov_base = buf; bdev_io->u.bdev.iovs[0].iov_base = buf;
@ -1969,6 +1972,7 @@ spdk_bdev_writev_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE; bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE;
bdev_io->u.bdev.iovs = iov; bdev_io->u.bdev.iovs = iov;
bdev_io->u.bdev.iovcnt = iovcnt; bdev_io->u.bdev.iovcnt = iovcnt;
@ -2020,6 +2024,7 @@ spdk_bdev_write_zeroes_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channe
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->u.bdev.offset_blocks = offset_blocks; bdev_io->u.bdev.offset_blocks = offset_blocks;
if (_spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_WRITE_ZEROES)) { if (_spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_WRITE_ZEROES)) {
@ -2103,6 +2108,7 @@ spdk_bdev_unmap_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_UNMAP; bdev_io->type = SPDK_BDEV_IO_TYPE_UNMAP;
bdev_io->u.bdev.iovs = &bdev_io->iov; bdev_io->u.bdev.iovs = &bdev_io->iov;
@ -2155,6 +2161,7 @@ spdk_bdev_flush_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_FLUSH; bdev_io->type = SPDK_BDEV_IO_TYPE_FLUSH;
bdev_io->u.bdev.iovs = NULL; bdev_io->u.bdev.iovs = NULL;
bdev_io->u.bdev.iovcnt = 0; bdev_io->u.bdev.iovcnt = 0;
@ -2261,6 +2268,7 @@ spdk_bdev_reset(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_RESET; bdev_io->type = SPDK_BDEV_IO_TYPE_RESET;
bdev_io->u.reset.ch_ref = NULL; bdev_io->u.reset.ch_ref = NULL;
spdk_bdev_io_init(bdev_io, bdev, cb_arg, cb); spdk_bdev_io_init(bdev_io, bdev, cb_arg, cb);
@ -2357,6 +2365,7 @@ spdk_bdev_nvme_admin_passthru(struct spdk_bdev_desc *desc, struct spdk_io_channe
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_NVME_ADMIN; bdev_io->type = SPDK_BDEV_IO_TYPE_NVME_ADMIN;
bdev_io->u.nvme_passthru.cmd = *cmd; bdev_io->u.nvme_passthru.cmd = *cmd;
bdev_io->u.nvme_passthru.buf = buf; bdev_io->u.nvme_passthru.buf = buf;
@ -2394,6 +2403,7 @@ spdk_bdev_nvme_io_passthru(struct spdk_bdev_desc *desc, struct spdk_io_channel *
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_NVME_IO; bdev_io->type = SPDK_BDEV_IO_TYPE_NVME_IO;
bdev_io->u.nvme_passthru.cmd = *cmd; bdev_io->u.nvme_passthru.cmd = *cmd;
bdev_io->u.nvme_passthru.buf = buf; bdev_io->u.nvme_passthru.buf = buf;
@ -2431,6 +2441,7 @@ spdk_bdev_nvme_io_passthru_md(struct spdk_bdev_desc *desc, struct spdk_io_channe
} }
bdev_io->internal.ch = channel; bdev_io->internal.ch = channel;
bdev_io->internal.desc = desc;
bdev_io->type = SPDK_BDEV_IO_TYPE_NVME_IO_MD; bdev_io->type = SPDK_BDEV_IO_TYPE_NVME_IO_MD;
bdev_io->u.nvme_passthru.cmd = *cmd; bdev_io->u.nvme_passthru.cmd = *cmd;
bdev_io->u.nvme_passthru.buf = buf; bdev_io->u.nvme_passthru.buf = buf;