env: Add an API to lookup the memory pool created by the primary process

Add spdk_mempool_lookup to lookup the memory pool created by the
primary process. This will be utilized in SPDK multi process
application future.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I90505b6566dfc93ef5957ef4c73b1a6438c30742
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459739
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-06-28 17:18:30 +09:00 committed by Ben Walker
parent 60c8845fd0
commit a57daa6976
3 changed files with 18 additions and 0 deletions

View File

@ -66,6 +66,9 @@ The parameter `free_space` has been added to spdk_ring_enqueue() to wait when
the ring is almost full and resume when there is enough space available in
the ring.
A new API `spdk_mempool_lookup` has been added to lookup the memory pool created
by the primary process.
## v19.04:
### nvme

View File

@ -442,6 +442,15 @@ size_t spdk_mempool_count(const struct spdk_mempool *pool);
uint32_t spdk_mempool_obj_iter(struct spdk_mempool *mp, spdk_mempool_obj_cb_t obj_cb,
void *obj_cb_arg);
/**
* Lookup the memory pool identified by the given name.
*
* \param name Name of the memory pool.
*
* \return a pointer to the memory pool on success, or NULL on failure.
*/
struct spdk_mempool *spdk_mempool_lookup(const char *name);
/**
* Get the number of dedicated CPU cores utilized by this env abstraction.
*

View File

@ -296,6 +296,12 @@ spdk_mempool_obj_iter(struct spdk_mempool *mp, spdk_mempool_obj_cb_t obj_cb,
obj_cb_arg);
}
struct spdk_mempool *
spdk_mempool_lookup(const char *name)
{
return (struct spdk_mempool *)rte_mempool_lookup(name);
}
bool
spdk_process_is_primary(void)
{