Commit 27a23a33 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

blobfs: switch to spdk_*malloc()



spdk_dma_*malloc() is about to be deprecated.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 076ebfad
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static void
cli_cleanup(struct cli_context_t *cli_context)
{
	if (cli_context->buff) {
		spdk_dma_free(cli_context->buff);
		spdk_free(cli_context->buff);
	}
	if (cli_context->cli_mode == CLI_MODE_SCRIPT) {
		int i;
@@ -685,8 +685,8 @@ dump_imp_open_cb(void *cb_arg, struct spdk_blob *blob, int bserrno)
	 * We'll transfer just one io_unit at a time to keep the buffer
	 * small. This could be bigger of course.
	 */
	cli_context->buff = spdk_dma_malloc(cli_context->io_unit_size,
					    ALIGN_4K, NULL);
	cli_context->buff = spdk_malloc(cli_context->io_unit_size, ALIGN_4K, NULL,
					SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
	if (cli_context->buff == NULL) {
		printf("Error in allocating memory\n");
		spdk_blob_close(cli_context->blob, close_cb, cli_context);
@@ -780,8 +780,8 @@ fill_blob_cb(void *arg1, struct spdk_blob *blob, int bserrno)
	cli_context->blob = blob;
	cli_context->io_unit_count = 0;
	cli_context->blob_io_units = spdk_blob_get_num_io_units(cli_context->blob);
	cli_context->buff = spdk_dma_malloc(cli_context->io_unit_size,
					    ALIGN_4K, NULL);
	cli_context->buff = spdk_malloc(cli_context->io_unit_size, ALIGN_4K, NULL,
					SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
	if (cli_context->buff == NULL) {
		unload_bs(cli_context, "Error in allocating memory",
			  -ENOMEM);
+8 −6
Original line number Diff line number Diff line
@@ -61,8 +61,8 @@ struct hello_context_t {
static void
hello_cleanup(struct hello_context_t *hello_context)
{
	spdk_dma_free(hello_context->read_buff);
	spdk_dma_free(hello_context->write_buff);
	spdk_free(hello_context->read_buff);
	spdk_free(hello_context->write_buff);
	free(hello_context);
}

@@ -179,8 +179,9 @@ read_blob(struct hello_context_t *hello_context)
{
	SPDK_NOTICELOG("entry\n");

	hello_context->read_buff = spdk_dma_malloc(hello_context->page_size,
				   0x1000, NULL);
	hello_context->read_buff = spdk_malloc(hello_context->page_size,
					       0x1000, NULL, SPDK_ENV_LCORE_ID_ANY,
					       SPDK_MALLOC_DMA);
	if (hello_context->read_buff == NULL) {
		unload_bs(hello_context, "Error in memory allocation",
			  -ENOMEM);
@@ -224,8 +225,9 @@ blob_write(struct hello_context_t *hello_context)
	 * Buffers for data transfer need to be allocated via SPDK. We will
	 * tranfer 1 page of 4K aligned data at offset 0 in the blob.
	 */
	hello_context->write_buff = spdk_dma_malloc(hello_context->page_size,
				    0x1000, NULL);
	hello_context->write_buff = spdk_malloc(hello_context->page_size,
						0x1000, NULL, SPDK_ENV_LCORE_ID_ANY,
						SPDK_MALLOC_DMA);
	if (hello_context->write_buff == NULL) {
		unload_bs(hello_context, "Error in allocating memory",
			  -ENOMEM);
+3 −2
Original line number Diff line number Diff line
@@ -1579,7 +1579,7 @@ __rw_done(void *ctx, int bserrno)
	struct spdk_fs_request *req = ctx;
	struct spdk_fs_cb_args *args = &req->args;

	spdk_dma_free(args->op.rw.pin_buf);
	spdk_free(args->op.rw.pin_buf);
	args->fn.file_op(args->arg, bserrno);
	free_fs_request(req);
}
@@ -1671,7 +1671,8 @@ __readwrite(struct spdk_file *file, struct spdk_io_channel *_channel,
	args->op.rw.blocklen = lba_size;

	pin_buf_length = num_lba * lba_size;
	args->op.rw.pin_buf = spdk_dma_malloc(pin_buf_length, lba_size, NULL);
	args->op.rw.pin_buf = spdk_malloc(pin_buf_length, lba_size, NULL,
					  SPDK_ENV_SOCKET_ID_ANY, SPDK_MALLOC_DMA);
	if (args->op.rw.pin_buf == NULL) {
		SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Failed to allocate buf for: file=%s offset=%jx length=%jx\n",
			      file->name, offset, length);