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) {