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

bdev/raid: enable multiple iovs



The bdevio tests will now work on RAID volumes, so enable
RAID testing there too.

It is probably safe now to just build RAID by default, and
not require --with-raid - but let's do some more testing
with vhost and NVMe-oF against it first before we do so.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I15697f035cb688574a7ecb8be24d0c84fc622d83

Reviewed-on: https://review.gerrithub.io/423408


Reviewed-by: default avatarKunal Sablok <kunal.sablok@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent 43ab58b6
Loading
Loading
Loading
Loading
+10 −17
Original line number Diff line number Diff line
@@ -297,7 +297,6 @@ raid_bdev_submit_children(struct spdk_bdev_io *bdev_io, uint64_t start_strip)
	struct raid_bdev_io		*raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
	struct raid_bdev_io_channel	*raid_ch = spdk_io_channel_get_ctx(raid_io->ch);
	struct raid_bdev		*raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
	uint8_t				*buf = bdev_io->u.bdev.iovs->iov_base;
	uint64_t			pd_strip;
	uint32_t			offset_in_strip;
	uint64_t			pd_lba;
@@ -321,14 +320,16 @@ raid_bdev_submit_children(struct spdk_bdev_io *bdev_io, uint64_t start_strip)
	 * function and function callback context
	 */
	if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
		ret = spdk_bdev_read_blocks(raid_bdev->base_bdev_info[pd_idx].desc,
		ret = spdk_bdev_readv_blocks(raid_bdev->base_bdev_info[pd_idx].desc,
					     raid_ch->base_channel[pd_idx],
					    buf, pd_lba, pd_blocks, raid_bdev_io_completion,
					     bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt,
					     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,
		ret = spdk_bdev_writev_blocks(raid_bdev->base_bdev_info[pd_idx].desc,
					      raid_ch->base_channel[pd_idx],
					     buf, pd_lba, pd_blocks, raid_bdev_io_completion,
					      bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt,
					      pd_lba, pd_blocks, raid_bdev_io_completion,
					      bdev_io);
	} else {
		SPDK_ERRLOG("Recvd not supported io type %u\n", bdev_io->type);
@@ -446,15 +447,6 @@ _raid_bdev_submit_rw_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bd
	uint64_t			end_strip = 0;
	int				ret;

	if (bdev_io->u.bdev.iovcnt != 1) {
		SPDK_ERRLOG("iov vector count is not 1\n");
		spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
		return;
	}

	/*
	 * IO parameters used during io split and io completion
	 */
	raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
	raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
	raid_io->ch = ch;
@@ -465,6 +457,7 @@ _raid_bdev_submit_rw_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bd
		assert(false);
		SPDK_ERRLOG("I/O spans strip boundary!\n");
		spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
		return;
	}
	ret = raid_bdev_submit_children(bdev_io, start_strip);
	if (ret != 0) {
+7 −0
Original line number Diff line number Diff line
@@ -29,3 +29,10 @@
  #
  # Assign 20000 IOPS for the Malloc0 block device
  Limit_IOPS Malloc0 20000

[RAID0]
  Name raid0
  StripSize 64
  NumDevices 2
  RaidLevel 0
  Devices Malloc4 Malloc5
+0 −5
Original line number Diff line number Diff line
@@ -84,11 +84,6 @@ timing_enter bounds
$testdir/bdevio/bdevio -c $testdir/bdev.conf
timing_exit bounds

# RAID module doesn't support multi-iov yet, so bdevio test
# would fail.  So wait to append the RAID configuration until
# after bdevio has run.
cat $testdir/raid.conf >> $testdir/bdev.conf

timing_enter nbd_gpt
if grep -q Nvme0 $testdir/bdev.conf; then
	part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir

test/bdev/raid.conf

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
[RAID0]
  Name raid0
  StripSize 64
  NumDevices 2
  RaidLevel 0
  Devices Malloc4 Malloc5
+8 −10
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
struct io_output {
	struct spdk_bdev_desc       *desc;
	struct spdk_io_channel      *ch;
	void                        *buf;
	uint64_t                    offset_blocks;
	uint64_t                    num_blocks;
	spdk_bdev_io_completion_cb  cb;
@@ -204,8 +203,9 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta

/* It will cache the split IOs for verification */
int
spdk_bdev_write_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
		       void *buf, uint64_t offset_blocks, uint64_t num_blocks,
spdk_bdev_writev_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
			struct iovec *iov, int iovcnt,
			uint64_t offset_blocks, uint64_t num_blocks,
			spdk_bdev_io_completion_cb cb, void *cb_arg)
{
	struct io_output *p = &g_io_output[g_io_output_index];
@@ -223,7 +223,6 @@ spdk_bdev_write_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
	if (g_bdev_io_submit_status == 0) {
		p->desc = desc;
		p->ch = ch;
		p->buf = buf;
		p->offset_blocks = offset_blocks;
		p->num_blocks = num_blocks;
		p->cb = cb;
@@ -404,8 +403,9 @@ spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)

/* It will cache split IOs for verification */
int
spdk_bdev_read_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
		      void *buf, uint64_t offset_blocks, uint64_t num_blocks,
spdk_bdev_readv_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
		       struct iovec *iov, int iovcnt,
		       uint64_t offset_blocks, uint64_t num_blocks,
		       spdk_bdev_io_completion_cb cb, void *cb_arg)
{
	struct io_output *p = &g_io_output[g_io_output_index];
@@ -419,7 +419,6 @@ spdk_bdev_read_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
	if (g_bdev_io_submit_status == 0) {
		p->desc = desc;
		p->ch = ch;
		p->buf = buf;
		p->offset_blocks = offset_blocks;
		p->num_blocks = num_blocks;
		p->cb = cb;
@@ -756,7 +755,6 @@ verify_io(struct spdk_bdev_io *bdev_io, uint8_t num_base_drives,
		CU_ASSERT(pd_blocks == g_io_output[index].num_blocks);
		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);
		buf += (pd_blocks << spdk_u32log2(g_block_len));
	}