Commit 1d6adfb0 authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

nvmf: Add commit parameter to zcopy end operation



Change-Id: I2803c806d623f345ce462b7fe1b7c02223008d9d
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8931


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 8c22b0ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -444,7 +444,7 @@ void spdk_nvmf_request_exec_fabrics(struct spdk_nvmf_request *req);
int spdk_nvmf_request_free(struct spdk_nvmf_request *req);
int spdk_nvmf_request_complete(struct spdk_nvmf_request *req);
int spdk_nvmf_request_zcopy_start(struct spdk_nvmf_request *req);
int spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req);
int spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req, bool commit);

/**
 * Remove the given qpair from the poll group.
+2 −2
Original line number Diff line number Diff line
@@ -3625,10 +3625,10 @@ end:
}

int
spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req)
spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req, bool commit)
{
	req->zcopy_phase = NVMF_ZCOPY_PHASE_END_PENDING;
	return nvmf_bdev_ctrlr_end_zcopy(req);
	return nvmf_bdev_ctrlr_end_zcopy(req, commit);
}

int
+1 −3
Original line number Diff line number Diff line
@@ -880,9 +880,7 @@ nvmf_bdev_ctrlr_end_zcopy_complete(struct spdk_bdev_io *bdev_io, bool success,
}

int
nvmf_bdev_ctrlr_end_zcopy(struct spdk_nvmf_request *req)
nvmf_bdev_ctrlr_end_zcopy(struct spdk_nvmf_request *req, bool commit)
{
	bool commit = (req->cmd->nvme_cmd.opc == SPDK_NVME_OPC_WRITE) ? true : false;

	return spdk_bdev_zcopy_end(req->zcopy_bdev_io, commit, nvmf_bdev_ctrlr_end_zcopy_complete, req);
}
+2 −1
Original line number Diff line number Diff line
@@ -466,10 +466,11 @@ int nvmf_bdev_ctrlr_start_zcopy(struct spdk_bdev *bdev,
 * Ends a zcopy operation
 *
 * \param req The NVMe-oF request
 * \param commit Flag indicating whether the buffers shoule be committed
 *
 * \return 0 upon success
 * \return <0 on error
 */
int nvmf_bdev_ctrlr_end_zcopy(struct spdk_nvmf_request *req);
int nvmf_bdev_ctrlr_end_zcopy(struct spdk_nvmf_request *req, bool commit);

#endif /* __NVMF_INTERNAL_H__ */
+3 −3
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ nvmf_bdev_ctrlr_start_zcopy(struct spdk_bdev *bdev,
}

int
nvmf_bdev_ctrlr_end_zcopy(struct spdk_nvmf_request *req)
nvmf_bdev_ctrlr_end_zcopy(struct spdk_nvmf_request *req, bool commit)
{
	req->zcopy_bdev_io = NULL;
	spdk_nvmf_request_complete(req);
@@ -2452,7 +2452,7 @@ test_zcopy_read(void)
	CU_ASSERT(ns_info.io_outstanding == 1);

	/* Perform the zcopy end */
	spdk_nvmf_request_zcopy_end(&req);
	spdk_nvmf_request_zcopy_end(&req, false);
	CU_ASSERT(req.zcopy_bdev_io == NULL);
	CU_ASSERT(req.zcopy_phase == NVMF_ZCOPY_PHASE_COMPLETE);
	CU_ASSERT(qpair.outstanding.tqh_first == NULL);
@@ -2537,7 +2537,7 @@ test_zcopy_write(void)
	CU_ASSERT(ns_info.io_outstanding == 1);

	/* Perform the zcopy end */
	spdk_nvmf_request_zcopy_end(&req);
	spdk_nvmf_request_zcopy_end(&req, true);
	CU_ASSERT(req.zcopy_bdev_io == NULL);
	CU_ASSERT(req.zcopy_phase == NVMF_ZCOPY_PHASE_COMPLETE);
	CU_ASSERT(qpair.outstanding.tqh_first == NULL);
Loading