From f34ce6fb07b236641aede47298ac10f723a82575 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Tue, 22 Mar 2022 17:01:51 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12173 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- include/spdk_internal/sock.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/spdk_internal/sock.h b/include/spdk_internal/sock.h index 2f2a14993..e8b083982 100644 --- a/include/spdk_internal/sock.h +++ b/include/spdk_internal/sock.h @@ -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) {