Commit d6afc7f3 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Changpeng Liu
Browse files

ocf: switch to spdk_*malloc().



spdk_dma_*malloc() is about to be deprecated.

Change-Id: Id49d700116bdd977893c6b89470764d97d9293bd
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449799


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent bef5509d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ vbdev_ocf_ctx_data_alloc(uint32_t pages)
	data = vbdev_ocf_data_alloc(1);

	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) {
		return NULL;
	}
@@ -75,7 +76,7 @@ vbdev_ocf_ctx_data_free(ctx_data_t *ctx_data)
	}

	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);
+10 −6
Original line number Diff line number Diff line
@@ -115,34 +115,38 @@ typedef uint64_t sector_t;

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)
{
	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)
{
	return spdk_dma_free((void *)ptr);
	return spdk_free((void *)ptr);
}

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)
{
	/* TODO: raw_ram init can request huge amount of memory to store
	 * 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)
{
	return spdk_dma_free((void *)ptr);
	return spdk_free((void *)ptr);
}

static inline uint64_t env_get_free_memory(void)