ocf: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated. Change-Id: Id49d700116bdd977893c6b89470764d97d9293bd Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449799 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
bef5509d4f
commit
d6afc7f33c
@ -52,7 +52,8 @@ vbdev_ocf_ctx_data_alloc(uint32_t pages)
|
|||||||
data = vbdev_ocf_data_alloc(1);
|
data = vbdev_ocf_data_alloc(1);
|
||||||
|
|
||||||
sz = pages * PAGE_SIZE;
|
sz = pages * PAGE_SIZE;
|
||||||
buf = spdk_dma_malloc(sz, PAGE_SIZE, NULL);
|
buf = spdk_malloc(sz, PAGE_SIZE, NULL,
|
||||||
|
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -75,7 +76,7 @@ vbdev_ocf_ctx_data_free(ctx_data_t *ctx_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < data->iovcnt; i++) {
|
for (i = 0; i < data->iovcnt; i++) {
|
||||||
spdk_dma_free(data->iovs[i].iov_base);
|
spdk_free(data->iovs[i].iov_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
vbdev_ocf_data_free(data);
|
vbdev_ocf_data_free(data);
|
||||||
|
16
lib/bdev/ocf/env/ocf_env.h
vendored
16
lib/bdev/ocf/env/ocf_env.h
vendored
@ -115,34 +115,38 @@ typedef uint64_t sector_t;
|
|||||||
|
|
||||||
static inline void *env_malloc(size_t size, int flags)
|
static inline void *env_malloc(size_t size, int flags)
|
||||||
{
|
{
|
||||||
return spdk_dma_malloc(size, 0, NULL);
|
return spdk_malloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_zalloc(size_t size, int flags)
|
static inline void *env_zalloc(size_t size, int flags)
|
||||||
{
|
{
|
||||||
return spdk_dma_zmalloc(size, 0, NULL);
|
return spdk_zmalloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_free(const void *ptr)
|
static inline void env_free(const void *ptr)
|
||||||
{
|
{
|
||||||
return spdk_dma_free((void *)ptr);
|
return spdk_free((void *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_vmalloc(size_t size)
|
static inline void *env_vmalloc(size_t size)
|
||||||
{
|
{
|
||||||
return spdk_dma_malloc(size, 0, NULL);
|
return spdk_malloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_vzalloc(size_t size)
|
static inline void *env_vzalloc(size_t size)
|
||||||
{
|
{
|
||||||
/* TODO: raw_ram init can request huge amount of memory to store
|
/* TODO: raw_ram init can request huge amount of memory to store
|
||||||
* hashtable in it. need to ensure that allocation succedds */
|
* hashtable in it. need to ensure that allocation succedds */
|
||||||
return spdk_dma_zmalloc(size, 0, NULL);
|
return spdk_zmalloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_vfree(const void *ptr)
|
static inline void env_vfree(const void *ptr)
|
||||||
{
|
{
|
||||||
return spdk_dma_free((void *)ptr);
|
return spdk_free((void *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_get_free_memory(void)
|
static inline uint64_t env_get_free_memory(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user