Commit f2017d2e authored by Jim Harris's avatar Jim Harris
Browse files

thread: rearrange spdk_iobuf_initialize()



Put all of the opts setup first, followed by the iobuf setup. This
prepares for some future changes.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I13c7a17c6e9e9c7f8e35d333cbaa02f31b7cb9d3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24516


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent b82fd48a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ spdk_iobuf_initialize(void)
	uint64_t i;
	struct spdk_iobuf_buffer *buf;

	/* Round up to the nearest alignment so that each element remains aligned */
	opts->small_bufsize = SPDK_ALIGN_CEIL(opts->small_bufsize, IOBUF_ALIGNMENT);
	opts->large_bufsize = SPDK_ALIGN_CEIL(opts->large_bufsize, IOBUF_ALIGNMENT);

	g_iobuf.small_pool = spdk_ring_create(SPDK_RING_TYPE_MP_MC, opts->small_pool_count,
					      SPDK_ENV_NUMA_ID_ANY);
	if (!g_iobuf.small_pool) {
@@ -108,8 +112,6 @@ spdk_iobuf_initialize(void)
		goto error;
	}

	/* Round up to the nearest alignment so that each element remains aligned */
	opts->small_bufsize = SPDK_ALIGN_CEIL(opts->small_bufsize, IOBUF_ALIGNMENT);
	g_iobuf.small_pool_base = spdk_malloc(opts->small_bufsize * opts->small_pool_count, IOBUF_ALIGNMENT,
					      NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);
	if (g_iobuf.small_pool_base == NULL) {
@@ -126,8 +128,6 @@ spdk_iobuf_initialize(void)
		goto error;
	}

	/* Round up to the nearest alignment so that each element remains aligned */
	opts->large_bufsize = SPDK_ALIGN_CEIL(opts->large_bufsize, IOBUF_ALIGNMENT);
	g_iobuf.large_pool_base = spdk_malloc(opts->large_bufsize * opts->large_pool_count, IOBUF_ALIGNMENT,
					      NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);
	if (g_iobuf.large_pool_base == NULL) {