Commit 6a75bb94 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Darek Stojaczyk
Browse files

bdev/part: separate buffer metadata support



Allow requests using separate buffer for metadata IO if base bdev
supports it. Copy base bdev's metadata configuration (separate /
interleaved, size, DIF type and location).

Change-Id: I89996f89cad805e696cacf0bba486b4cc1f617e6
Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458407


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
parent 9b96749f
Loading
Loading
Loading
Loading
+32 −8
Original line number Diff line number Diff line
@@ -218,17 +218,35 @@ spdk_bdev_part_submit_request(struct spdk_bdev_part_channel *ch, struct spdk_bde
	switch (bdev_io->type) {
	case SPDK_BDEV_IO_TYPE_READ:
		offset = bdev_io->u.bdev.offset_blocks + part->internal.offset_blocks;
		if (bdev_io->u.bdev.md_buf == NULL) {
			rc = spdk_bdev_readv_blocks(base_desc, base_ch, bdev_io->u.bdev.iovs,
						    bdev_io->u.bdev.iovcnt, offset,
					    bdev_io->u.bdev.num_blocks, spdk_bdev_part_complete_io,
					    bdev_io);
						    bdev_io->u.bdev.num_blocks,
						    spdk_bdev_part_complete_io, bdev_io);
		} else {
			rc = spdk_bdev_readv_blocks_with_md(base_desc, base_ch,
							    bdev_io->u.bdev.iovs,
							    bdev_io->u.bdev.iovcnt,
							    bdev_io->u.bdev.md_buf, offset,
							    bdev_io->u.bdev.num_blocks,
							    spdk_bdev_part_complete_io, bdev_io);
		}
		break;
	case SPDK_BDEV_IO_TYPE_WRITE:
		offset = bdev_io->u.bdev.offset_blocks + part->internal.offset_blocks;
		if (bdev_io->u.bdev.md_buf == NULL) {
			rc = spdk_bdev_writev_blocks(base_desc, base_ch, bdev_io->u.bdev.iovs,
						     bdev_io->u.bdev.iovcnt, offset,
					     bdev_io->u.bdev.num_blocks, spdk_bdev_part_complete_io,
					     bdev_io);
						     bdev_io->u.bdev.num_blocks,
						     spdk_bdev_part_complete_io, bdev_io);
		} else {
			rc = spdk_bdev_writev_blocks_with_md(base_desc, base_ch,
							     bdev_io->u.bdev.iovs,
							     bdev_io->u.bdev.iovcnt,
							     bdev_io->u.bdev.md_buf, offset,
							     bdev_io->u.bdev.num_blocks,
							     spdk_bdev_part_complete_io, bdev_io);
		}
		break;
	case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
		offset = bdev_io->u.bdev.offset_blocks + part->internal.offset_blocks;
@@ -346,6 +364,12 @@ spdk_bdev_part_construct(struct spdk_bdev_part *part, struct spdk_bdev_part_base
	part->internal.bdev.module = base->module;
	part->internal.bdev.fn_table = base->fn_table;

	part->internal.bdev.md_interleave = base->bdev->md_interleave;
	part->internal.bdev.md_len = base->bdev->md_len;
	part->internal.bdev.dif_type = base->bdev->dif_type;
	part->internal.bdev.dif_is_head_of_md = base->bdev->dif_is_head_of_md;
	part->internal.bdev.dif_check_flags = base->bdev->dif_check_flags;

	part->internal.bdev.name = strdup(name);
	part->internal.bdev.product_name = strdup(product_name);