From: Jens Axboe <axboe@kernel.dk>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH for-next] io_uring: add async data clear/free helpers
Date: Tue, 26 Aug 2025 10:04:55 -0600 [thread overview]
Message-ID: <810863fb-4479-46ff-9a2b-1b0e3293ee71@kernel.dk> (raw)
In-Reply-To: <CADUfDZqcgkpbdY5jH8UwQNc5RBi-QKR=sw2fsgALPFzKBNcbUw@mail.gmail.com>
On 8/26/25 9:27 AM, Caleb Sander Mateos wrote:
>> diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
>> index 2e4f7223a767..86613b8224bd 100644
>> --- a/io_uring/io_uring.h
>> +++ b/io_uring/io_uring.h
>> @@ -281,6 +281,19 @@ static inline bool req_has_async_data(struct io_kiocb *req)
>> return req->flags & REQ_F_ASYNC_DATA;
>> }
>>
>> +static inline void io_req_async_data_clear(struct io_kiocb *req,
>> + io_req_flags_t extra_flags)
>> +{
>> + req->flags &= ~(REQ_F_ASYNC_DATA|extra_flags);
>> + req->async_data = NULL;
>> +}
>> +
>> +static inline void io_req_async_data_free(struct io_kiocb *req)
>> +{
>> + kfree(req->async_data);
>> + io_req_async_data_clear(req, 0);
>> +}
>
> Would it make sense to also add a helper for assigning async_data that
> would also make sure to set REQ_F_ASYNC_DATA?
I did consider that, but it's only futex that'd use it and just in those
two spots. So decided against it. At least for now.
>> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
>> index ff1d029633b8..09f2a47a0020 100644
>> --- a/io_uring/uring_cmd.c
>> +++ b/io_uring/uring_cmd.c
>> @@ -37,8 +37,7 @@ static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)
>>
>> if (io_alloc_cache_put(&req->ctx->cmd_cache, ac)) {
>> ioucmd->sqe = NULL;
>> - req->async_data = NULL;
>> - req->flags &= ~(REQ_F_ASYNC_DATA|REQ_F_NEED_CLEANUP);
>> + io_req_async_data_clear(req, 0);
>
> Looks like the REQ_F_NEED_CLEANUP got lost here. Other than that,
Oops indeed, added back.
> Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Thanks for the review!
--
Jens Axboe
next prev parent reply other threads:[~2025-08-26 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 14:04 [PATCH for-next] io_uring: add async data clear/free helpers Jens Axboe
2025-08-26 15:27 ` Caleb Sander Mateos
2025-08-26 16:04 ` Jens Axboe [this message]
2025-08-26 16:10 ` Caleb Sander Mateos
2025-08-26 18:40 ` Jens Axboe
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=810863fb-4479-46ff-9a2b-1b0e3293ee71@kernel.dk \
--to=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=io-uring@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