Commit 5681a8a6 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

dif: remove packed attribute from spdk_dif_ctx_init_ext_opts



Following the recommendation introduced in 1d77eec8, the packed
attribute was removed from spdk_dif_ctx_init_ext_opts and the way its
size is calculated was changed to use SPDK_SIZEOF().

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


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
parent 85aac107
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -754,7 +754,7 @@ bdevperf_verify_dif(struct bdevperf_task *task, struct iovec *iovs, int iovcnt)
	int			rc;
	struct spdk_dif_ctx_init_ext_opts dif_opts;

	dif_opts.size = sizeof(struct spdk_dif_ctx_init_ext_opts);
	dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
	dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;
	rc = spdk_dif_ctx_init(&dif_ctx,
			       spdk_bdev_get_block_size(bdev),
@@ -932,7 +932,7 @@ bdevperf_generate_dif(struct bdevperf_task *task)
	int			rc;
	struct spdk_dif_ctx_init_ext_opts dif_opts;

	dif_opts.size = sizeof(struct spdk_dif_ctx_init_ext_opts);
	dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
	dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;
	rc = spdk_dif_ctx_init(&dif_ctx,
			       spdk_bdev_get_block_size(bdev),
+2 −2
Original line number Diff line number Diff line
@@ -809,7 +809,7 @@ fio_extended_lba_setup_pi(struct spdk_fio_qpair *fio_qpair, struct io_u *io_u)
	lba = io_u->offset / extended_lba_size;
	lba_count = io_u->xfer_buflen / extended_lba_size;

	dif_opts.size = sizeof(struct spdk_dif_ctx_init_ext_opts);
	dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
	dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;
	rc = spdk_dif_ctx_init(&fio_req->dif_ctx, extended_lba_size, md_size,
			       true, fio_qpair->md_start,
@@ -858,7 +858,7 @@ fio_separate_md_setup_pi(struct spdk_fio_qpair *fio_qpair, struct io_u *io_u)
	lba = io_u->offset / block_size;
	lba_count = io_u->xfer_buflen / block_size;

	dif_opts.size = sizeof(struct spdk_dif_ctx_init_ext_opts);
	dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
	dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;
	rc = spdk_dif_ctx_init(&fio_req->dif_ctx, block_size, md_size,
			       false, fio_qpair->md_start,
+1 −1
Original line number Diff line number Diff line
@@ -871,7 +871,7 @@ nvme_submit_io(struct perf_task *task, struct ns_worker_ctx *ns_ctx,
	}

	if (mode != DIF_MODE_NONE) {
		dif_opts.size = sizeof(struct spdk_dif_ctx_init_ext_opts);
		dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
		dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;
		rc = spdk_dif_ctx_init(&task->dif_ctx, entry->block_size, entry->md_size,
				       entry->md_interleave, entry->pi_loc,
+4 −4
Original line number Diff line number Diff line
@@ -36,12 +36,12 @@ enum spdk_dif_pi_format {
};

struct spdk_dif_ctx_init_ext_opts {
	/** size of this structure in bytes */
	/** Size of this structure in bytes, use SPDK_SIZEOF() to calculate it */
	size_t size;

	enum spdk_dif_pi_format dif_pi_format;
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_dif_ctx_init_ext_opts) == 12, "Incorrect size");
	uint32_t dif_pi_format;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_dif_ctx_init_ext_opts) == 16, "Incorrect size");

/** DIF context information */
struct spdk_dif_ctx {
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ bdev_part_remap_dif(struct spdk_bdev_io *bdev_io, uint32_t offset,
		return 0;
	}

	dif_opts.size = sizeof(struct spdk_dif_ctx_init_ext_opts);
	dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
	dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;
	rc = spdk_dif_ctx_init(&dif_ctx,
			       bdev->blocklen, bdev->md_len, bdev->md_interleave,
Loading