bdev/null: allocate bdev struct using regular calloc
spdk_dma_malloc() is not required here, as the bdev struct is neither DMA-able nor shared between processes. While here, also allocate g_null_read_buf using spdk_zmalloc() instead of spdk_dma_zmalloc(), as spdk_dma_*malloc() is about to be deprecated. Change-Id: I0dc344bc84932607c2e22a124e2093e87714ec5e Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448170 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
c781fdee2f
commit
5118004b1d
@ -80,7 +80,7 @@ bdev_null_destruct(void *ctx)
|
||||
|
||||
TAILQ_REMOVE(&g_null_bdev_head, bdev, tailq);
|
||||
free(bdev->bdev.name);
|
||||
spdk_dma_free(bdev);
|
||||
free(bdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -188,7 +188,7 @@ create_null_bdev(const char *name, const struct spdk_uuid *uuid,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bdev = spdk_dma_zmalloc(sizeof(*bdev), 0, NULL);
|
||||
bdev = calloc(1, sizeof(*bdev));
|
||||
if (!bdev) {
|
||||
SPDK_ERRLOG("could not allocate null_bdev\n");
|
||||
return NULL;
|
||||
@ -196,7 +196,7 @@ create_null_bdev(const char *name, const struct spdk_uuid *uuid,
|
||||
|
||||
bdev->bdev.name = strdup(name);
|
||||
if (!bdev->bdev.name) {
|
||||
spdk_dma_free(bdev);
|
||||
free(bdev);
|
||||
return NULL;
|
||||
}
|
||||
bdev->bdev.product_name = "Null disk";
|
||||
@ -217,7 +217,7 @@ create_null_bdev(const char *name, const struct spdk_uuid *uuid,
|
||||
rc = spdk_bdev_register(&bdev->bdev);
|
||||
if (rc) {
|
||||
free(bdev->bdev.name);
|
||||
spdk_dma_free(bdev);
|
||||
free(bdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -295,7 +295,8 @@ bdev_null_initialize(void)
|
||||
* Instead of using a real rbuf from the bdev pool, just always point to
|
||||
* this same zeroed buffer.
|
||||
*/
|
||||
g_null_read_buf = spdk_dma_zmalloc(SPDK_BDEV_LARGE_BUF_MAX_SIZE, 0, NULL);
|
||||
g_null_read_buf = spdk_zmalloc(SPDK_BDEV_LARGE_BUF_MAX_SIZE, 0, NULL,
|
||||
SPDK_ENV_SOCKET_ID_ANY, SPDK_MALLOC_DMA);
|
||||
|
||||
/*
|
||||
* We need to pick some unique address as our "io device" - so just use the
|
||||
@ -365,7 +366,7 @@ end:
|
||||
static void
|
||||
_bdev_null_finish_cb(void *arg)
|
||||
{
|
||||
spdk_dma_free(g_null_read_buf);
|
||||
spdk_free(g_null_read_buf);
|
||||
spdk_bdev_module_finish_done();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user