Commit cdd64c1c authored by Jim Harris's avatar Jim Harris Committed by Ben Walker
Browse files

ut/reduce: modify write_maps test to write full chunks



This test verifies that all of the io_unit_index[] entries
are written.  For that to really happen, the write for
the chunks must not be compressible.  Currently the compress
algorithm just copies the data and doesn't actually
compress - so writing a partial chunk works OK for this test.
But upcoming patches will add a 'real' compression unit test
algorithm - at which point, writing just part of a chunk
will be compressible since the non-written parts will be all
zero.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449566


Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent d25f2db9
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -698,14 +698,16 @@ _write_maps(uint32_t backing_blocklen)
	struct spdk_reduce_vol_params params = {};
	struct spdk_reduce_backing_dev backing_dev = {};
	struct iovec iov;
	char buf[16 * 1024]; /* chunk size */
	uint32_t i;
	const int bufsize = 16 * 1024; /* chunk size */
	char buf[bufsize];
	uint32_t num_lbas, i;
	uint64_t old_chunk0_map_index, new_chunk0_map_index;
	struct spdk_reduce_chunk_map *old_chunk0_map, *new_chunk0_map;

	params.chunk_size = 16 * 1024;
	params.chunk_size = bufsize;
	params.backing_io_unit_size = 4096;
	params.logical_block_size = 512;
	num_lbas = bufsize / params.logical_block_size;
	spdk_uuid_generate(&params.uuid);

	backing_dev_init(&backing_dev, &params, backing_blocklen);
@@ -720,10 +722,11 @@ _write_maps(uint32_t backing_blocklen)
		CU_ASSERT(_vol_get_chunk_map_index(g_vol, i) == REDUCE_EMPTY_MAP_ENTRY);
	}

	ut_build_data_buffer(buf, bufsize, 0x00, 1);
	iov.iov_base = buf;
	iov.iov_len = params.logical_block_size;
	iov.iov_len = bufsize;
	g_reduce_errno = -1;
	spdk_reduce_vol_writev(g_vol, &iov, 1, 0, 1, write_cb, NULL);
	spdk_reduce_vol_writev(g_vol, &iov, 1, 0, num_lbas, write_cb, NULL);
	CU_ASSERT(g_reduce_errno == 0);

	old_chunk0_map_index = _vol_get_chunk_map_index(g_vol, 0);
@@ -738,7 +741,7 @@ _write_maps(uint32_t backing_blocklen)
	}

	g_reduce_errno = -1;
	spdk_reduce_vol_writev(g_vol, &iov, 1, 0, 1, write_cb, NULL);
	spdk_reduce_vol_writev(g_vol, &iov, 1, 0, num_lbas, write_cb, NULL);
	CU_ASSERT(g_reduce_errno == 0);

	new_chunk0_map_index = _vol_get_chunk_map_index(g_vol, 0);