blobfs: switch to spdk_*malloc()
spdk_dma_*malloc() is about to be deprecated. Change-Id: Ib9fb94463a69ffd9660ab2c7fbe02826a7e06741 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449796 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
076ebfadfa
commit
27a23a33f9
@ -197,7 +197,7 @@ static void
|
|||||||
cli_cleanup(struct cli_context_t *cli_context)
|
cli_cleanup(struct cli_context_t *cli_context)
|
||||||
{
|
{
|
||||||
if (cli_context->buff) {
|
if (cli_context->buff) {
|
||||||
spdk_dma_free(cli_context->buff);
|
spdk_free(cli_context->buff);
|
||||||
}
|
}
|
||||||
if (cli_context->cli_mode == CLI_MODE_SCRIPT) {
|
if (cli_context->cli_mode == CLI_MODE_SCRIPT) {
|
||||||
int i;
|
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
|
* We'll transfer just one io_unit at a time to keep the buffer
|
||||||
* small. This could be bigger of course.
|
* small. This could be bigger of course.
|
||||||
*/
|
*/
|
||||||
cli_context->buff = spdk_dma_malloc(cli_context->io_unit_size,
|
cli_context->buff = spdk_malloc(cli_context->io_unit_size, ALIGN_4K, NULL,
|
||||||
ALIGN_4K, NULL);
|
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||||
if (cli_context->buff == NULL) {
|
if (cli_context->buff == NULL) {
|
||||||
printf("Error in allocating memory\n");
|
printf("Error in allocating memory\n");
|
||||||
spdk_blob_close(cli_context->blob, close_cb, cli_context);
|
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->blob = blob;
|
||||||
cli_context->io_unit_count = 0;
|
cli_context->io_unit_count = 0;
|
||||||
cli_context->blob_io_units = spdk_blob_get_num_io_units(cli_context->blob);
|
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,
|
cli_context->buff = spdk_malloc(cli_context->io_unit_size, ALIGN_4K, NULL,
|
||||||
ALIGN_4K, NULL);
|
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||||
if (cli_context->buff == NULL) {
|
if (cli_context->buff == NULL) {
|
||||||
unload_bs(cli_context, "Error in allocating memory",
|
unload_bs(cli_context, "Error in allocating memory",
|
||||||
-ENOMEM);
|
-ENOMEM);
|
||||||
|
@ -61,8 +61,8 @@ struct hello_context_t {
|
|||||||
static void
|
static void
|
||||||
hello_cleanup(struct hello_context_t *hello_context)
|
hello_cleanup(struct hello_context_t *hello_context)
|
||||||
{
|
{
|
||||||
spdk_dma_free(hello_context->read_buff);
|
spdk_free(hello_context->read_buff);
|
||||||
spdk_dma_free(hello_context->write_buff);
|
spdk_free(hello_context->write_buff);
|
||||||
free(hello_context);
|
free(hello_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,8 +179,9 @@ read_blob(struct hello_context_t *hello_context)
|
|||||||
{
|
{
|
||||||
SPDK_NOTICELOG("entry\n");
|
SPDK_NOTICELOG("entry\n");
|
||||||
|
|
||||||
hello_context->read_buff = spdk_dma_malloc(hello_context->page_size,
|
hello_context->read_buff = spdk_malloc(hello_context->page_size,
|
||||||
0x1000, NULL);
|
0x1000, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
|
SPDK_MALLOC_DMA);
|
||||||
if (hello_context->read_buff == NULL) {
|
if (hello_context->read_buff == NULL) {
|
||||||
unload_bs(hello_context, "Error in memory allocation",
|
unload_bs(hello_context, "Error in memory allocation",
|
||||||
-ENOMEM);
|
-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
|
* 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.
|
* tranfer 1 page of 4K aligned data at offset 0 in the blob.
|
||||||
*/
|
*/
|
||||||
hello_context->write_buff = spdk_dma_malloc(hello_context->page_size,
|
hello_context->write_buff = spdk_malloc(hello_context->page_size,
|
||||||
0x1000, NULL);
|
0x1000, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
|
SPDK_MALLOC_DMA);
|
||||||
if (hello_context->write_buff == NULL) {
|
if (hello_context->write_buff == NULL) {
|
||||||
unload_bs(hello_context, "Error in allocating memory",
|
unload_bs(hello_context, "Error in allocating memory",
|
||||||
-ENOMEM);
|
-ENOMEM);
|
||||||
|
@ -1579,7 +1579,7 @@ __rw_done(void *ctx, int bserrno)
|
|||||||
struct spdk_fs_request *req = ctx;
|
struct spdk_fs_request *req = ctx;
|
||||||
struct spdk_fs_cb_args *args = &req->args;
|
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);
|
args->fn.file_op(args->arg, bserrno);
|
||||||
free_fs_request(req);
|
free_fs_request(req);
|
||||||
}
|
}
|
||||||
@ -1671,7 +1671,8 @@ __readwrite(struct spdk_file *file, struct spdk_io_channel *_channel,
|
|||||||
args->op.rw.blocklen = lba_size;
|
args->op.rw.blocklen = lba_size;
|
||||||
|
|
||||||
pin_buf_length = num_lba * 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) {
|
if (args->op.rw.pin_buf == NULL) {
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Failed to allocate buf for: file=%s offset=%jx length=%jx\n",
|
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Failed to allocate buf for: file=%s offset=%jx length=%jx\n",
|
||||||
file->name, offset, length);
|
file->name, offset, length);
|
||||||
|
Loading…
Reference in New Issue
Block a user