sock: add spdk_sock_request_complete

Extracted the code that completes requests to a separate function.  This
will make it possible to use it with read requests, which aren't using
request queues.

Change-Id: I101f36bab6def753d548d766acd17020b504873e
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12173
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Konrad Sztyber 2022-03-22 17:01:51 +01:00 committed by Tomasz Zawadzki
parent 6453cbe783
commit f34ce6fb07

View File

@ -137,17 +137,11 @@ spdk_sock_request_pend(struct spdk_sock *sock, struct spdk_sock_request *req)
}
static inline int
spdk_sock_request_put(struct spdk_sock *sock, struct spdk_sock_request *req, int err)
spdk_sock_request_complete(struct spdk_sock *sock, struct spdk_sock_request *req, int err)
{
bool closed;
int rc = 0;
assert(req->internal.curr_list == &sock->pending_reqs);
TAILQ_REMOVE(&sock->pending_reqs, req, internal.link);
#ifdef DEBUG
req->internal.curr_list = NULL;
#endif
req->internal.offset = 0;
req->internal.is_zcopy = 0;
@ -166,6 +160,17 @@ spdk_sock_request_put(struct spdk_sock *sock, struct spdk_sock_request *req, int
return rc;
}
static inline int
spdk_sock_request_put(struct spdk_sock *sock, struct spdk_sock_request *req, int err)
{
assert(req->internal.curr_list == &sock->pending_reqs);
TAILQ_REMOVE(&sock->pending_reqs, req, internal.link);
#ifdef DEBUG
req->internal.curr_list = NULL;
#endif
return spdk_sock_request_complete(sock, req, err);
}
static inline int
spdk_sock_abort_requests(struct spdk_sock *sock)
{