Extend io_mapped_ubuf to cover external bvec table for supporting fused command kbuf, in which the bvec table could be from one IO request. Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- io_uring/rsrc.c | 5 +++-- io_uring/rsrc.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index a59fc02de598..c41edd197b0a 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1221,7 +1221,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, goto done; } - imu = kvmalloc(struct_size(imu, bvec, nr_pages), GFP_KERNEL); + imu = kvmalloc(struct_size(imu, __bvec, nr_pages), GFP_KERNEL); if (!imu) goto done; @@ -1237,7 +1237,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, size_t vec_len; vec_len = min_t(size_t, size, PAGE_SIZE - off); - bvec_set_page(&imu->bvec[i], pages[i], vec_len, off); + bvec_set_page(&imu->__bvec[i], pages[i], vec_len, off); off = 0; size -= vec_len; } @@ -1245,6 +1245,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, imu->ubuf = (unsigned long) iov->iov_base; imu->ubuf_end = imu->ubuf + iov->iov_len; imu->nr_bvecs = nr_pages; + imu->bvec = imu->__bvec; *pimu = imu; ret = 0; done: diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index 774aca20326c..24329eca49ef 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -50,7 +50,8 @@ struct io_mapped_ubuf { u64 ubuf_end; unsigned int nr_bvecs; unsigned int acct_pages; - struct bio_vec bvec[]; + struct bio_vec *bvec; + struct bio_vec __bvec[]; }; void io_rsrc_put_tw(struct callback_head *cb); -- 2.31.1