Commit ab9661c9 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Ben Walker
Browse files

bdev/raid: Simplify variable name in struct raid_bdev_io_channel



base_bdevs_io_channel is good but base_channel may be enough and
fit other bdev modules.

Change-Id: I67a1d224f1ef4ca1fc048b4325333f2552a37150
Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/422921


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
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>
Reviewed-by: default avatarKunal Sablok <kunal.sablok@intel.com>
parent bc5906b1
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
@@ -92,9 +92,9 @@ raid_bdev_create_cb(void *io_device, void *ctx_buf)
	assert(raid_bdev != NULL);
	assert(raid_bdev->state == RAID_BDEV_STATE_ONLINE);

	raid_ch->base_bdevs_io_channel = calloc(raid_bdev->num_base_bdevs,
	raid_ch->base_channel = calloc(raid_bdev->num_base_bdevs,
				       sizeof(struct spdk_io_channel *));
	if (!raid_ch->base_bdevs_io_channel) {
	if (!raid_ch->base_channel) {
		SPDK_ERRLOG("Unable to allocate base bdevs io channel\n");
		return -1;
	}
@@ -104,13 +104,13 @@ raid_bdev_create_cb(void *io_device, void *ctx_buf)
		 * split logic to send the respective child bdev ios to respective base
		 * bdev io channel.
		 */
		raid_ch->base_bdevs_io_channel[i] = spdk_bdev_get_io_channel(
		raid_ch->base_channel[i] = spdk_bdev_get_io_channel(
						   raid_bdev->base_bdev_info[i].desc);
		if (!raid_ch->base_bdevs_io_channel[i]) {
		if (!raid_ch->base_channel[i]) {
			for (uint32_t j = 0; j < i; j++) {
				spdk_put_io_channel(raid_ch->base_bdevs_io_channel[j]);
				spdk_put_io_channel(raid_ch->base_channel[j]);
			}
			free(raid_ch->base_bdevs_io_channel);
			free(raid_ch->base_channel);
			SPDK_ERRLOG("Unable to create io channel for base bdev\n");
			return -1;
		}
@@ -139,15 +139,15 @@ raid_bdev_destroy_cb(void *io_device, void *ctx_buf)

	assert(raid_bdev != NULL);
	assert(raid_ch != NULL);
	assert(raid_ch->base_bdevs_io_channel);
	assert(raid_ch->base_channel);
	for (uint32_t i = 0; i < raid_bdev->num_base_bdevs; i++) {
		/* Free base bdev channels */
		assert(raid_ch->base_bdevs_io_channel[i] != NULL);
		spdk_put_io_channel(raid_ch->base_bdevs_io_channel[i]);
		raid_ch->base_bdevs_io_channel[i] = NULL;
		assert(raid_ch->base_channel[i] != NULL);
		spdk_put_io_channel(raid_ch->base_channel[i]);
		raid_ch->base_channel[i] = NULL;
	}
	free(raid_ch->base_bdevs_io_channel);
	raid_ch->base_bdevs_io_channel = NULL;
	free(raid_ch->base_channel);
	raid_ch->base_channel = NULL;
}

/*
@@ -333,14 +333,14 @@ raid_bdev_send_passthru(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io
	raid_bdev_io->splits_comp_outstanding = 1;
	if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
		ret = spdk_bdev_read_blocks(raid_bdev->base_bdev_info[0].desc,
					    raid_ch->base_bdevs_io_channel[0],
					    raid_ch->base_channel[0],
					    bdev_io->u.bdev.iovs->iov_base,
					    bdev_io->u.bdev.offset_blocks,
					    bdev_io->u.bdev.num_blocks, raid_bdev_io_completion,
					    bdev_io);
	} else if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) {
		ret = spdk_bdev_write_blocks(raid_bdev->base_bdev_info[0].desc,
					     raid_ch->base_bdevs_io_channel[0],
					     raid_ch->base_channel[0],
					     bdev_io->u.bdev.iovs->iov_base,
					     bdev_io->u.bdev.offset_blocks,
					     bdev_io->u.bdev.num_blocks, raid_bdev_io_completion,
@@ -435,13 +435,13 @@ raid_bdev_submit_children(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_
		 */
		if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
			ret = spdk_bdev_read_blocks(raid_bdev->base_bdev_info[pd_idx].desc,
						    raid_ch->base_bdevs_io_channel[pd_idx],
						    raid_ch->base_channel[pd_idx],
						    buf, pd_lba, pd_blocks, raid_bdev_io_completion,
						    bdev_io);

		} else if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) {
			ret = spdk_bdev_write_blocks(raid_bdev->base_bdev_info[pd_idx].desc,
						     raid_ch->base_bdevs_io_channel[pd_idx],
						     raid_ch->base_channel[pd_idx],
						     buf, pd_lba, pd_blocks, raid_bdev_io_completion,
						     bdev_io);
		} else {
@@ -549,7 +549,7 @@ raid_bdev_io_submit_fail_process(struct raid_bdev *raid_bdev, struct spdk_bdev_i
		raid_bdev_io->waitq_entry.cb_arg = raid_bdev_io;
		raid_ch = spdk_io_channel_get_ctx(raid_bdev_io->ch);
		if (spdk_bdev_queue_io_wait(raid_bdev->base_bdev_info[pd_idx].bdev,
					    raid_ch->base_bdevs_io_channel[pd_idx],
					    raid_ch->base_channel[pd_idx],
					    &raid_bdev_io->waitq_entry) != 0) {
			SPDK_ERRLOG("bdev io waitq error, it should not happen\n");
			assert(0);
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ struct raid_config {
 */
struct raid_bdev_io_channel {
	/* Array of IO channels of base bdevs */
	struct spdk_io_channel      **base_bdevs_io_channel;
	struct spdk_io_channel      **base_channel;
};

/* TAIL heads for various raid bdev lists */
+16 −16
Original line number Diff line number Diff line
@@ -719,7 +719,7 @@ verify_io(struct spdk_bdev_io *bdev_io, uint8_t num_base_drives,
			}
			CU_ASSERT(pd_lba == g_io_output[index].offset_blocks);
			CU_ASSERT(pd_blocks == g_io_output[index].num_blocks);
			CU_ASSERT(ch_ctx->base_bdevs_io_channel[pd_idx] == g_io_output[index].ch);
			CU_ASSERT(ch_ctx->base_channel[pd_idx] == g_io_output[index].ch);
			CU_ASSERT(raid_bdev->base_bdev_info[pd_idx].desc == g_io_output[index].desc);
			CU_ASSERT(buf == g_io_output[index].buf);
			CU_ASSERT(bdev_io->type == g_io_output[index].iotype);
@@ -729,7 +729,7 @@ verify_io(struct spdk_bdev_io *bdev_io, uint8_t num_base_drives,
		CU_ASSERT(g_io_output_index == 1);
		CU_ASSERT(bdev_io->u.bdev.offset_blocks == g_io_output[0].offset_blocks);
		CU_ASSERT(bdev_io->u.bdev.num_blocks == g_io_output[0].num_blocks);
		CU_ASSERT(ch_ctx->base_bdevs_io_channel[0] == g_io_output[0].ch);
		CU_ASSERT(ch_ctx->base_channel[0] == g_io_output[0].ch);
		CU_ASSERT(raid_bdev->base_bdev_info[0].desc == g_io_output[0].desc);
		CU_ASSERT(buf == g_io_output[index].buf);
	}
@@ -1299,10 +1299,10 @@ test_io_channel(void)

	CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
	for (i = 0; i < req.base_bdevs.num_base_bdevs; i++) {
		CU_ASSERT(ch_ctx->base_bdevs_io_channel && ch_ctx->base_bdevs_io_channel[i] == (void *)0x1);
		CU_ASSERT(ch_ctx->base_channel && ch_ctx->base_channel[i] == (void *)0x1);
	}
	raid_bdev_destroy_cb(pbdev, ch_ctx);
	CU_ASSERT(ch_ctx->base_bdevs_io_channel == NULL);
	CU_ASSERT(ch_ctx->base_channel == NULL);
	free_test_req(&req);

	destroy_req.name = strdup("raid1");
@@ -1361,7 +1361,7 @@ test_write_io(void)

	CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
	for (i = 0; i < req.base_bdevs.num_base_bdevs; i++) {
		CU_ASSERT(ch_ctx->base_bdevs_io_channel && ch_ctx->base_bdevs_io_channel[i] == (void *)0x1);
		CU_ASSERT(ch_ctx->base_channel && ch_ctx->base_channel[i] == (void *)0x1);
	}

	lba = 0;
@@ -1382,7 +1382,7 @@ test_write_io(void)
	free_test_req(&req);

	raid_bdev_destroy_cb(pbdev, ch_ctx);
	CU_ASSERT(ch_ctx->base_bdevs_io_channel == NULL);
	CU_ASSERT(ch_ctx->base_channel == NULL);
	free(ch);
	destroy_req.name = strdup("raid1");
	rpc_req = &destroy_req;
@@ -1439,7 +1439,7 @@ test_read_io(void)

	CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
	for (i = 0; i < req.base_bdevs.num_base_bdevs; i++) {
		CU_ASSERT(ch_ctx->base_bdevs_io_channel && ch_ctx->base_bdevs_io_channel[i] == (void *)0x1);
		CU_ASSERT(ch_ctx->base_channel && ch_ctx->base_channel[i] == (void *)0x1);
	}
	free_test_req(&req);

@@ -1460,7 +1460,7 @@ test_read_io(void)
	}

	raid_bdev_destroy_cb(pbdev, ch_ctx);
	CU_ASSERT(ch_ctx->base_bdevs_io_channel == NULL);
	CU_ASSERT(ch_ctx->base_channel == NULL);
	free(ch);
	destroy_req.name = strdup("raid1");
	rpc_req = &destroy_req;
@@ -1518,7 +1518,7 @@ test_io_failure(void)

	CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
	for (i = 0; i < req.base_bdevs.num_base_bdevs; i++) {
		CU_ASSERT(ch_ctx->base_bdevs_io_channel && ch_ctx->base_bdevs_io_channel[i] == (void *)0x1);
		CU_ASSERT(ch_ctx->base_channel && ch_ctx->base_channel[i] == (void *)0x1);
	}
	free_test_req(&req);

@@ -1557,7 +1557,7 @@ test_io_failure(void)
	}

	raid_bdev_destroy_cb(pbdev, ch_ctx);
	CU_ASSERT(ch_ctx->base_bdevs_io_channel == NULL);
	CU_ASSERT(ch_ctx->base_channel == NULL);
	free(ch);
	destroy_req.name = strdup("raid1");
	rpc_req = &destroy_req;
@@ -1616,9 +1616,9 @@ test_io_waitq(void)
	SPDK_CU_ASSERT_FATAL(ch_ctx != NULL);

	CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
	SPDK_CU_ASSERT_FATAL(ch_ctx->base_bdevs_io_channel != NULL);
	SPDK_CU_ASSERT_FATAL(ch_ctx->base_channel != NULL);
	for (i = 0; i < req.base_bdevs.num_base_bdevs; i++) {
		CU_ASSERT(ch_ctx->base_bdevs_io_channel[i] == (void *)0x1);
		CU_ASSERT(ch_ctx->base_channel[i] == (void *)0x1);
	}
	free_test_req(&req);

@@ -1649,7 +1649,7 @@ test_io_waitq(void)
	}

	raid_bdev_destroy_cb(pbdev, ch_ctx);
	CU_ASSERT(ch_ctx->base_bdevs_io_channel == NULL);
	CU_ASSERT(ch_ctx->base_channel == NULL);
	g_ignore_io_output = 0;
	free(ch);
	destroy_req.name = strdup("raid1");
@@ -1852,9 +1852,9 @@ test_multi_raid_with_io(void)
		ch_ctx = spdk_io_channel_get_ctx(&ch[i]);
		SPDK_CU_ASSERT_FATAL(ch_ctx != NULL);
		CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
		CU_ASSERT(ch_ctx->base_bdevs_io_channel != NULL);
		CU_ASSERT(ch_ctx->base_channel != NULL);
		for (j = 0; j < construct_req[i].base_bdevs.num_base_bdevs; j++) {
			CU_ASSERT(ch_ctx->base_bdevs_io_channel[j] == (void *)0x1);
			CU_ASSERT(ch_ctx->base_channel[j] == (void *)0x1);
		}
	}

@@ -1894,7 +1894,7 @@ test_multi_raid_with_io(void)
		ch_ctx = spdk_io_channel_get_ctx(&ch[i]);
		SPDK_CU_ASSERT_FATAL(ch_ctx != NULL);
		raid_bdev_destroy_cb(pbdev, ch_ctx);
		CU_ASSERT(ch_ctx->base_bdevs_io_channel == NULL);
		CU_ASSERT(ch_ctx->base_channel == NULL);
		destroy_req.name = strdup(construct_req[i].name);
		count = snprintf(name, 16, "%s", destroy_req.name);
		name[count] = '\0';