nvmf: make zcopy_end void

Since spdk_bdev_zcopy_end() cannot really fail (it only fails if we pass
a bad bdev_io), we can simplify the nvmf zcopy_end functions by making
them void and always expect asynchronous completion.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I6e88ac28aba13acadea88489ac0dd20d1f52f999
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10790
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Konrad Sztyber 2021-12-07 07:58:01 +01:00 committed by Jim Harris
parent 92d7df1f47
commit 7a374fbc0b
7 changed files with 10 additions and 19 deletions

View File

@ -449,7 +449,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);
void spdk_nvmf_request_zcopy_start(struct spdk_nvmf_request *req);
int spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req, bool commit);
void spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req, bool commit);
static inline bool
spdk_nvmf_request_using_zcopy(const struct spdk_nvmf_request *req)

View File

@ -3731,11 +3731,13 @@ spdk_nvmf_request_zcopy_start(struct spdk_nvmf_request *req)
spdk_nvmf_request_exec(req);
}
int
void
spdk_nvmf_request_zcopy_end(struct spdk_nvmf_request *req, bool commit)
{
assert(req->zcopy_phase == NVMF_ZCOPY_PHASE_EXECUTE);
req->zcopy_phase = NVMF_ZCOPY_PHASE_END_PENDING;
return nvmf_bdev_ctrlr_zcopy_end(req, commit);
nvmf_bdev_ctrlr_zcopy_end(req, commit);
}
int

View File

@ -909,7 +909,7 @@ nvmf_bdev_ctrlr_zcopy_end_complete(struct spdk_bdev_io *bdev_io, bool success,
spdk_nvmf_request_complete(req);
}
int
void
nvmf_bdev_ctrlr_zcopy_end(struct spdk_nvmf_request *req, bool commit)
{
int rc __attribute__((unused));
@ -918,6 +918,4 @@ nvmf_bdev_ctrlr_zcopy_end(struct spdk_nvmf_request *req, bool commit)
/* The only way spdk_bdev_zcopy_end() can fail is if we pass a bdev_io type that isn't ZCOPY */
assert(rc == 0);
return SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS;
}

View File

@ -498,12 +498,7 @@ int nvmf_bdev_ctrlr_zcopy_start(struct spdk_bdev *bdev,
*
* \param req The NVMe-oF request
* \param commit Flag indicating whether the buffers should be committed
*
* \return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE if the command was completed immediately or
* SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS if the command was submitted and will be
* completed asynchronously. Asynchronous completions are notified through
* spdk_nvmf_request_complete().
*/
int nvmf_bdev_ctrlr_zcopy_end(struct spdk_nvmf_request *req, bool commit);
void nvmf_bdev_ctrlr_zcopy_end(struct spdk_nvmf_request *req, bool commit);
#endif /* __NVMF_INTERNAL_H__ */

View File

@ -294,12 +294,11 @@ nvmf_bdev_ctrlr_zcopy_start(struct spdk_bdev *bdev,
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
int
void
nvmf_bdev_ctrlr_zcopy_end(struct spdk_nvmf_request *req, bool commit)
{
req->zcopy_bdev_io = NULL;
spdk_nvmf_request_complete(req);
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
static void

View File

@ -133,7 +133,7 @@ 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);
DEFINE_STUB_V(spdk_nvmf_request_zcopy_end, (struct spdk_nvmf_request *req, bool commit));
const char *
spdk_nvme_transport_id_trtype_str(enum spdk_nvme_transport_type trtype)

View File

@ -198,10 +198,7 @@ DEFINE_STUB(nvmf_bdev_ctrlr_zcopy_start,
struct spdk_nvmf_request *req),
0);
DEFINE_STUB(nvmf_bdev_ctrlr_zcopy_end,
int,
(struct spdk_nvmf_request *req, bool commit),
0);
DEFINE_STUB_V(nvmf_bdev_ctrlr_zcopy_end, (struct spdk_nvmf_request *req, bool commit));
DEFINE_STUB_V(spdk_nvmf_request_free_buffers,
(struct spdk_nvmf_request *req, struct spdk_nvmf_transport_poll_group *group,