nvmf: Add commit parameter to zcopy end operation

Change-Id: I2803c806d623f345ce462b7fe1b7c02223008d9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8931
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ben Walker 2021-07-26 10:16:54 -07:00 committed by Tomasz Zawadzki
parent 8c22b0ab1c
commit 1d6adfb09c
7 changed files with 12 additions and 11 deletions

View File

@ -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.

View File

@ -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

View File

@ -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);
}

View File

@ -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__ */

View File

@ -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);

View File

@ -133,6 +133,8 @@ DEFINE_STUB_V(rte_hash_free, (struct rte_hash *h));
DEFINE_STUB(nvmf_fc_lld_port_add, int, (struct spdk_nvmf_fc_port *fc_port), 0);
DEFINE_STUB(nvmf_fc_lld_port_remove, int, (struct spdk_nvmf_fc_port *fc_port), 0);
DEFINE_STUB(spdk_nvmf_request_zcopy_end, int, (struct spdk_nvmf_request *req, bool commit), 0);
const char *
spdk_nvme_transport_id_trtype_str(enum spdk_nvme_transport_type trtype)
{

View File

@ -199,7 +199,7 @@ DEFINE_STUB(nvmf_bdev_ctrlr_start_zcopy,
DEFINE_STUB(nvmf_bdev_ctrlr_end_zcopy,
int,
(struct spdk_nvmf_request *req),
(struct spdk_nvmf_request *req, bool commit),
0);
DEFINE_STUB_V(spdk_nvmf_request_free_buffers,