public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.18] io_uring/query: return number of available queries
@ 2025-11-10 13:03 Pavel Begunkov
  2025-11-10 22:00 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-11-10 13:03 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence

It's useful to know which query opcodes are available. Extend the
structure and return that. It's a trivial change, and even though it can
be painlessly extended later, it'd still require adding a v2 of the
structure.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---

Note: the query interface is extendible, but it's still best to avoid
changing structure sizes as it may cause trouble for multi component
application using different definitions. So the extensions would look
like creating a v2 of the structure and migrating all kernel code to
it. Also, tests work just fine even without updating the structure
just as intended.

 include/uapi/linux/io_uring/query.h | 3 +++
 io_uring/query.c                    | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/include/uapi/linux/io_uring/query.h b/include/uapi/linux/io_uring/query.h
index 5d754322a27c..3539ccbfd064 100644
--- a/include/uapi/linux/io_uring/query.h
+++ b/include/uapi/linux/io_uring/query.h
@@ -36,6 +36,9 @@ struct io_uring_query_opcode {
 	__u64	enter_flags;
 	/* Bitmask of all supported IOSQE_* flags */
 	__u64	sqe_flags;
+	/* The number of available query opcodes */
+	__u32	nr_query_opcodes;
+	__u32	__pad;
 };
 
 #endif
diff --git a/io_uring/query.c b/io_uring/query.c
index 645301bd2c82..cf02893ba911 100644
--- a/io_uring/query.c
+++ b/io_uring/query.c
@@ -20,6 +20,8 @@ static ssize_t io_query_ops(void *data)
 	e->ring_setup_flags = IORING_SETUP_FLAGS;
 	e->enter_flags = IORING_ENTER_FLAGS;
 	e->sqe_flags = SQE_VALID_FLAGS;
+	e->nr_query_opcodes = __IO_URING_QUERY_MAX;
+	e->__pad = 0;
 	return sizeof(*e);
 }
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6.18] io_uring/query: return number of available queries
  2025-11-10 13:03 [PATCH 6.18] io_uring/query: return number of available queries Pavel Begunkov
@ 2025-11-10 22:00 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-11-10 22:00 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov


On Mon, 10 Nov 2025 13:03:53 +0000, Pavel Begunkov wrote:
> It's useful to know which query opcodes are available. Extend the
> structure and return that. It's a trivial change, and even though it can
> be painlessly extended later, it'd still require adding a v2 of the
> structure.
> 
> 

Applied, thanks!

[1/1] io_uring/query: return number of available queries
      commit: 6a77267d97b5b6cd0e35099ab4eb054e5f965ee6

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-10 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 13:03 [PATCH 6.18] io_uring/query: return number of available queries Pavel Begunkov
2025-11-10 22:00 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox