thread: Add spdk_io_channel_get_io_device() to get io_device from io_channel
This will be useful as the same purpose as spdk_io_channel_iter_get_io_device() and will be used in the following patches. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Id45f5980c65543703b91df2afeb47448232fe503 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7237 Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
b3f998e58b
commit
0247a9945a
@ -102,6 +102,11 @@ bool to int. We can use RPC to configure different value of enable_placement_id.
|
||||
Then we can leverage SO_INCOMING_CPU to get placement_id, which aims to utilize
|
||||
CPU cache locality, enabled by setting enable_placement_id=2.
|
||||
|
||||
### thread
|
||||
|
||||
A new API `spdk_io_channel_get_io_device` was added to get the io_device for the specified
|
||||
I/O channel.
|
||||
|
||||
## v21.01:
|
||||
|
||||
### idxd
|
||||
|
@ -721,6 +721,15 @@ struct spdk_io_channel *spdk_io_channel_iter_get_channel(struct spdk_io_channel_
|
||||
*/
|
||||
void *spdk_io_channel_iter_get_ctx(struct spdk_io_channel_iter *i);
|
||||
|
||||
/**
|
||||
* Get the io_device for the specified I/O channel.
|
||||
*
|
||||
* \param ch I/O channel.
|
||||
*
|
||||
* \return a pointer to the io_device for the I/O channel
|
||||
*/
|
||||
void *spdk_io_channel_get_io_device(struct spdk_io_channel *ch);
|
||||
|
||||
/**
|
||||
* Helper function to iterate all channels for spdk_for_each_channel().
|
||||
*
|
||||
|
@ -41,6 +41,7 @@
|
||||
spdk_io_channel_get_ctx;
|
||||
spdk_io_channel_from_ctx;
|
||||
spdk_io_channel_get_thread;
|
||||
spdk_io_channel_get_io_device;
|
||||
spdk_for_each_channel;
|
||||
spdk_io_channel_iter_get_io_device;
|
||||
spdk_io_channel_iter_get_channel;
|
||||
|
@ -1680,6 +1680,12 @@ spdk_io_channel_get_thread(struct spdk_io_channel *ch)
|
||||
return ch->thread;
|
||||
}
|
||||
|
||||
void *
|
||||
spdk_io_channel_get_io_device(struct spdk_io_channel *ch)
|
||||
{
|
||||
return ch->dev->io_device;
|
||||
}
|
||||
|
||||
struct spdk_io_channel_iter {
|
||||
void *io_device;
|
||||
struct io_device *dev;
|
||||
|
@ -702,12 +702,14 @@ channel(void)
|
||||
ch1 = spdk_get_io_channel(&g_device1);
|
||||
CU_ASSERT(g_create_cb_calls == 1);
|
||||
SPDK_CU_ASSERT_FATAL(ch1 != NULL);
|
||||
CU_ASSERT(spdk_io_channel_get_io_device(ch1) == &g_device1);
|
||||
|
||||
g_create_cb_calls = 0;
|
||||
ch2 = spdk_get_io_channel(&g_device1);
|
||||
CU_ASSERT(g_create_cb_calls == 0);
|
||||
CU_ASSERT(ch1 == ch2);
|
||||
SPDK_CU_ASSERT_FATAL(ch2 != NULL);
|
||||
CU_ASSERT(spdk_io_channel_get_io_device(ch2) == &g_device1);
|
||||
|
||||
g_destroy_cb_calls = 0;
|
||||
spdk_put_io_channel(ch2);
|
||||
@ -719,6 +721,7 @@ channel(void)
|
||||
CU_ASSERT(g_create_cb_calls == 1);
|
||||
CU_ASSERT(ch1 != ch2);
|
||||
SPDK_CU_ASSERT_FATAL(ch2 != NULL);
|
||||
CU_ASSERT(spdk_io_channel_get_io_device(ch2) == &g_device2);
|
||||
|
||||
ctx = spdk_io_channel_get_ctx(ch2);
|
||||
CU_ASSERT(*(uint64_t *)ctx == g_ctx2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user