Commit 8fb14726 authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

test/unit/blob: add IO_UT_BLOCKS_PER_CLUSTER



This avoids duplicating some hardcoded values.

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


Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 91a55bfe
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -6809,10 +6809,12 @@ blob_create_snapshot_power_failure(void)
	}
}

#define IO_UT_BLOCKS_PER_CLUSTER 32

static void
test_io_write(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_channel *channel)
{
	const uint32_t SZ = 32; /* size of cluster in 512-byte blocks */
	const uint32_t SZ = IO_UT_BLOCKS_PER_CLUSTER;
	uint8_t payload_ff[SZ * 512];
	uint8_t payload_aa[SZ * 512];
	uint8_t payload_00[SZ * 512];
@@ -6929,7 +6931,7 @@ test_io_write(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_ch
static void
test_io_read(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_channel *channel)
{
	const uint32_t SZ = 32; /* size of cluster in 512-byte blocks */
	const uint32_t SZ = IO_UT_BLOCKS_PER_CLUSTER;
	uint8_t payload_read[2 * SZ * 512];
	uint8_t payload_ff[SZ * 512];
	uint8_t payload_aa[SZ * 512];
@@ -7041,7 +7043,7 @@ test_io_read(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_cha
static void
test_io_unmap(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_channel *channel)
{
	const uint32_t SZ = 32; /* size of cluster in 512-byte blocks */
	const uint32_t SZ = IO_UT_BLOCKS_PER_CLUSTER;
	uint8_t payload_ff[SZ * 512];
	uint8_t payload_aa[SZ * 512];
	uint8_t payload_00[SZ * 512];
@@ -7067,7 +7069,7 @@ test_io_unmap(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_ch
static void
test_io_zeroes(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_channel *channel)
{
	const uint32_t SZ = 32; /* size of cluster in 512-byte blocks */
	const uint32_t SZ = IO_UT_BLOCKS_PER_CLUSTER;
	uint8_t payload_ff[SZ * 512];
	uint8_t payload_aa[SZ * 512];
	uint8_t payload_00[SZ * 512];
@@ -7115,7 +7117,7 @@ static void
test_iov_write(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_channel *channel,
	       bool ext_api)
{
	const uint32_t SZ = 32; /* size of cluster in 512-byte blocks */
	const uint32_t SZ = IO_UT_BLOCKS_PER_CLUSTER;
	uint8_t payload_ff[SZ * 512];
	uint8_t payload_aa[SZ * 512];
	uint8_t payload_00[SZ * 512];
@@ -7280,7 +7282,7 @@ static void
test_iov_read(struct spdk_bs_dev *dev, struct spdk_blob *blob, struct spdk_io_channel *channel,
	      bool ext_api)
{
	const uint32_t SZ = 32; /* size of cluster in 512-byte blocks */
	const uint32_t SZ = IO_UT_BLOCKS_PER_CLUSTER;
	uint8_t payload_read[2 * SZ * 512];
	uint8_t payload_ff[SZ * 512];
	uint8_t payload_aa[SZ * 512];
@@ -7444,7 +7446,7 @@ blob_io_unit(void)
	/* Create dev with 512 bytes io unit size */

	spdk_bs_opts_init(&bsopts, sizeof(bsopts));
	bsopts.cluster_sz = SPDK_BS_PAGE_SIZE * 4;	/* 8 * 4 = 32 io_unit */
	bsopts.cluster_sz = IO_UT_BLOCKS_PER_CLUSTER * 512;
	snprintf(bsopts.bstype.bstype, sizeof(bsopts.bstype.bstype), "TESTTYPE");

	/* Try to initialize a new blob store with unsupported io_unit */