Re: [PATCH for-next v8 5/5] nvme: wire up fixed buffer support for nvme passthrough

Christoph Hellwig
2022-09-23T15:40:51Z

On Fri, Sep 23, 2022 at 02:58:54PM +0530, Kanchan Joshi wrote:
> if (!vec)
> + if (!fixedbufs)
> + ret = blk_rq_map_user(q, req, NULL,
> + nvme_to_user_ptr(ubuffer), bufflen,
> + GFP_KERNEL);
> + else {
> + struct iov_iter iter;
> +
> + ret = io_uring_cmd_import_fixed(ubuffer, bufflen,
> + rq_data_dir(req), &iter, ioucmd);
> + if (ret < 0)
> + goto out;
> + ret = blk_rq_map_user_bvec(req, &iter);
> + }

Given that the fixedufs case doesn't handle the vec case we can
do with some untangling and a single level of indentation here.

Even with that a WARN_ON_ONCE() for that impossible case would be good
to have, though.