A few nits:

> diff --git a/io_uring/dma-buf.c b/io_uring/dma-buf.c
> new file mode 100644
> index 000000000000..1a1a88640823
> --- /dev/null
> +++ b/io_uring/dma-buf.c
> @@ -0,0 +1,66 @@
> +#include "dma-buf.h"

Needs SPDX license header.

> diff --git a/io_uring/dma-buf.h b/io_uring/dma-buf.h
> new file mode 100644
> index 000000000000..a876a9e5e272
> --- /dev/null
> +++ b/io_uring/dma-buf.h
> +static inline int io_attach_dmabuf_map(struct io_kiocb *req,
> +                                     struct iov_iter *iter,
> +                                     unsigned issue_flags)
> +{
> +     bool nowait = issue_flags & IO_URING_F_NONBLOCK;
> +     struct dma_buf_io_map *map;
> +     struct io_buf_dma *bd;
> +
> +     if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
> +             return -EOPNOTSUPP;
> +     if (!(req->flags & REQ_F_DMABUF))
> +             return 0;
> +
> +     bd = req->buf_node->buf->priv;
> +     map = dma_buf_io_get_map(bd->ctx, nowait);
> +     if (unlikely(IS_ERR(map)))
> +             return PTR_ERR(map);

No need for unlikely() with IS_ERR(), it already includes that.

-- 
Jens Axboe

Reply via email to