From: Jens Axboe <axboe@kernel.dk>
To: Hao Xu <haoxu.linux@gmail.com>, io-uring@vger.kernel.org
Cc: Pavel Begunkov <asml.silence@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] io_uring: implement multishot mode for accept
Date: Sat, 7 May 2022 09:23:59 -0600 [thread overview]
Message-ID: <a41a1f47-ad05-3245-8ac8-7d8e95ebde44@kernel.dk> (raw)
In-Reply-To: <20220507152009.87367-1-haoxu.linux@gmail.com>
On 5/7/22 9:20 AM, Hao Xu wrote:
> @@ -5757,8 +5771,26 @@ static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
> ret = io_install_fixed_file(req, file, issue_flags,
> accept->file_slot - 1);
> }
> - __io_req_complete(req, issue_flags, ret, 0);
> - return 0;
> +
> + if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
> + __io_req_complete(req, issue_flags, ret, 0);
> + return 0;
> + }
> + if (ret >= 0) {
> + bool filled;
> +
> + spin_lock(&ctx->completion_lock);
> + filled = io_fill_cqe_aux(ctx, req->cqe.user_data, ret,
> + IORING_CQE_F_MORE);
> + io_commit_cqring(ctx);
> + spin_unlock(&ctx->completion_lock);
> + if (!filled)
> + return -ECANCELED;
> + io_cqring_ev_posted(ctx);
> + goto retry;
> + }
> +
> + return ret;
I'd still make that:
if (filled) {
io_cqring_ev_posted(ctx);
goto retry;
}
ret = -ECANCELED;
as it flows better and shows what the likely outcome is.
> static int io_connect_prep_async(struct io_kiocb *req)
> diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
> index f4d9ca62a5a6..7c3d70d12428 100644
> --- a/include/uapi/linux/io_uring.h
> +++ b/include/uapi/linux/io_uring.h
> @@ -224,9 +224,9 @@ enum {
> #define IORING_RECVSEND_POLL_FIRST (1U << 0)
>
> /*
> - * accept flags stored in accept_flags
> + * accept flags stored in sqe->ioprio
> */
> -#define IORING_ACCEPT_MULTISHOT (1U << 15)
> +#define IORING_ACCEPT_MULTISHOT (1U << 0)
>
> /*
> * IO completion data structure (Completion Queue Entry)
This hunk needs to get folded in to the patch that adds the flag in the
first place.
--
Jens Axboe
prev parent reply other threads:[~2022-05-07 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-07 15:20 Hao Xu
2022-05-07 15:23 ` Jens Axboe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a41a1f47-ad05-3245-8ac8-7d8e95ebde44@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=haoxu.linux@gmail.com \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®