bdev/nvme: Call bdev_nvme_readv() directly when buffer is already allocated

bdev_nvme_submit_request() calls bdev_nvme_get_buf_cb() directly
when the buffer is already allocated. This is for performance improvement
but will be helpful for the upcoming multipath feature to retry
read I/O submission because buffer should be allocated only once.

By reading the code a little more critically, bdev_nvme_submit_request()
can call bdev_nvme_readv() directly in this case, and do in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I005c70deabf7fbfe84b7029e9ef103ae122605e1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5558
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2020-12-13 22:22:54 +09:00 committed by Tomasz Zawadzki
parent 2b9daef69e
commit 4956435757

View File

@ -642,12 +642,20 @@ _bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_
switch (bdev_io->type) {
case SPDK_BDEV_IO_TYPE_READ:
if (bdev_io->u.bdev.iovs && bdev_io->u.bdev.iovs[0].iov_base) {
bdev_nvme_get_buf_cb(ch, bdev_io, true);
return bdev_nvme_readv(nbdev->nvme_ns->ns,
nvme_ch->qpair,
nbdev_io,
bdev_io->u.bdev.iovs,
bdev_io->u.bdev.iovcnt,
bdev_io->u.bdev.md_buf,
bdev_io->u.bdev.num_blocks,
bdev_io->u.bdev.offset_blocks,
bdev->dif_check_flags);
} else {
spdk_bdev_io_get_buf(bdev_io, bdev_nvme_get_buf_cb,
bdev_io->u.bdev.num_blocks * bdev->blocklen);
}
return 0;
}
case SPDK_BDEV_IO_TYPE_WRITE:
return bdev_nvme_writev(nbdev->nvme_ns->ns,