[PATCH 3/5] liburiung: add io_uring_prep_cmd_zone_reset
Christoph Hellwig <[email protected]> Wed, 15 Jul 2026 08:39:30 +0200
| Newsgroups | org.kernel.vger.io-uring |
|---|---|
| Message-ID | <[email protected]> |
Add a helper for io_uring zone_reset_all commands. Signed-off-by: Christoph Hellwig <[email protected]> --- configure | 31 +++++++++++++++++++++++++++++++ src/include/liburing.h | 7 +++++++ src/liburing-ffi.map | 5 +++++ 3 files changed, 43 insertions(+) diff --git a/configure b/configure index b953eddd6ddc..8c5ca801f487 100755 --- a/configure +++ b/configure @@ -469,6 +469,21 @@ if compile_prog "" "" "discard command"; then fi print_config "discard command support" "$discard_cmd" +########################################## +# Check block zone_reset_all cmd support +zone_reset_all_cmd="no" +cat > $TMPC << EOF +#include <linux/blkdev.h> +int main(void) +{ + return BLOCK_URING_CMD_ZONE_RESET_ALL; +} +EOF +if compile_prog "" "" "zone_reset_all command"; then + zone_reset_all_cmd="yes" +fi +print_config "zone_reset_all command support" "$zone_reset_all_cmd" + ########################################## # Check idtype_t support has_idtype_t="no" @@ -797,6 +812,22 @@ else cat >> $compat_h << EOF EOF fi +if test "$zone_reset_all_cmd" != "yes"; then +cat >> $compat_h << EOF + +#include <linux/ioctl.h> + +#ifndef BLOCK_URING_CMD_ZONE_RESET_ALL +#define BLOCK_URING_CMD_ZONE_RESET_ALL _IO(0x12, 1) +#endif + +EOF +else cat >> $compat_h << EOF +#include <linux/blkdev.h> + +EOF +fi + cat >> $compat_h << EOF #endif EOF diff --git a/src/include/liburing.h b/src/include/liburing.h index 0188937b0de4..214c7778d6a7 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -1685,6 +1685,13 @@ IOURINGINLINE void io_uring_prep_cmd_discard(struct io_uring_sqe *sqe, sqe->addr3 = nbytes; } +IOURINGINLINE void io_uring_prep_cmd_zone_reset_all(struct io_uring_sqe *sqe, + int fd) + LIBURING_NOEXCEPT +{ + io_uring_prep_uring_cmd(sqe, BLOCK_URING_CMD_ZONE_RESET_ALL, fd); +} + IOURINGINLINE void io_uring_prep_pipe(struct io_uring_sqe *sqe, int *fds, int pipe_flags) { diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map index bd7bc64416d3..fc9701b63907 100644 --- a/src/liburing-ffi.map +++ b/src/liburing-ffi.map @@ -275,3 +275,8 @@ LIBURING_2.15 { io_uring_register_zcrx_ctrl; io_uring_register_query; } LIBURING_2.14; + +LIBURING_2.16 { + global: + io_uring_prep_cmd_zone_reset_all; +} LIBURING_2.14; -- 2.53.0