From 13017493afa2bcc44dcb795edc69c93114370feb Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Wed, 11 Oct 2017 18:47:52 +0200 Subject: [PATCH] bdev: added spdk_bdev_io_get_thread() This is required for virtio-initiator, where multiple io_channels have to share the same virtio queue. A single poller will receive responses from a virtio queue and send the completions to the thread that submitted bdev_io. Change-Id: I951c7655aaa17d41a680d437661afff27d2c3077 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/382200 Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System --- include/spdk_internal/bdev.h | 7 +++++++ lib/bdev/bdev.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/include/spdk_internal/bdev.h b/include/spdk_internal/bdev.h index 3ccc03ca2..124015c65 100644 --- a/include/spdk_internal/bdev.h +++ b/include/spdk_internal/bdev.h @@ -416,6 +416,13 @@ void spdk_bdev_io_complete_nvme_status(struct spdk_bdev_io *bdev_io, int sct, in void spdk_bdev_io_complete_scsi_status(struct spdk_bdev_io *bdev_io, enum spdk_scsi_status sc, enum spdk_scsi_sense sk, uint8_t asc, uint8_t ascq); +/** + * Get a thread that given bdev_io was submitted on. + * + * \param bdev_io I/O + * \return thread that submitted the I/O + */ +struct spdk_thread *spdk_bdev_io_get_thread(struct spdk_bdev_io *bdev_io); void spdk_scsi_nvme_translate(const struct spdk_bdev_io *bdev_io, int *sc, int *sk, int *asc, int *ascq); diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 1d9e97ab2..9cca51361 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -1628,6 +1628,12 @@ spdk_bdev_io_get_nvme_status(const struct spdk_bdev_io *bdev_io, int *sct, int * } } +struct spdk_thread * +spdk_bdev_io_get_thread(struct spdk_bdev_io *bdev_io) +{ + return spdk_io_channel_get_thread(bdev_io->ch->channel); +} + static void _spdk_bdev_register(struct spdk_bdev *bdev) {