On 2/24/25 21:31, Keith Busch wrote:
From: Keith Busch <kbusch@xxxxxxxxxx>
...
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index f814526982c36..e0c6ed3aef5b5 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -9,6 +9,7 @@
...
+int io_buffer_register_bvec(struct io_uring_cmd *cmd, struct request *rq,
+ void (*release)(void *), unsigned int index,
+ unsigned int issue_flags)
+{
+ struct io_ring_ctx *ctx = cmd_to_io_kiocb(cmd)->ctx;
+ struct io_rsrc_data *data = &ctx->buf_table;
+ struct req_iterator rq_iter;
+ struct io_mapped_ubuf *imu;
+ struct io_rsrc_node *node;
+ struct bio_vec bv, *bvec;
+ u16 nr_bvecs;
+ int ret = 0;
+
+
nit: extra new line
+ io_ring_submit_lock(ctx, issue_flags);
+ if (index >= data->nr) {
+ ret = -EINVAL;
+ goto unlock;
+ }
+ index = array_index_nospec(index, data->nr);
+
+ if (data->nodes[index] ) {
nit: extra space
+ ret = -EBUSY;
+ goto unlock;
+ }
+
...
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h
index f0e9080599646..64bf35667cf9c 100644
--- a/io_uring/rsrc.h
+++ b/io_uring/rsrc.h
@@ -20,6 +20,11 @@ struct io_rsrc_node {
};
};
+enum {
+ IO_IMU_READABLE = 1 << 0,
+ IO_IMU_WRITEABLE = 1 << 1,
1 << READ, 1 << WRITE
And let's add BUILD_BUG_ON that they fit into u8.
--
Pavel Begunkov