public inbox for [email protected]
 help / color / mirror / Atom feed
From: Christoph Hellwig <[email protected]>
To: Kanchan Joshi <[email protected]>
Cc: [email protected], [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected]
Subject: Re: [PATCH for-next v8 3/5] nvme: refactor nvme_alloc_user_request
Date: Fri, 23 Sep 2022 17:38:19 +0200	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

> -static void *nvme_add_user_metadata(struct bio *bio, void __user *ubuf,
> -		unsigned len, u32 seed, bool write)
> +static void *nvme_add_user_metadata(struct request *req, void __user *ubuf,
> +		unsigned len, u32 seed)

Please split out a separate patch just for the changes to
nvme_add_user_metadata.

> -	if (ret == len)
> +	if (ret == len) {
> +		req->cmd_flags |= REQ_INTEGRITY;
>  		return buf;
> +	}
>  	ret = -ENOMEM;

Nit: Please keep the successful path in line and branch out for the
errors, i.e.


	if (ret != len) {
	 	ret = -ENOMEM;
		goto out_free_meta;
	}

	req->cmd_flags |= REQ_INTEGRITY;
	return buf;

We should have done this already with the old code, but now that more
is added to the success path it becomes even more important:.

> +	else {
> +		struct iovec fast_iov[UIO_FASTIOV];
> +		struct iovec *iov = fast_iov;
> +		struct iov_iter iter;
> +
> +		ret = import_iovec(rq_data_dir(req), ubuffer, bufflen,
> +				UIO_FASTIOV, &iov, &iter);
> +		if (ret < 0)
>  			goto out;
> +		ret = blk_rq_map_user_iov(q, req, NULL, &iter, GFP_KERNEL);
> +		kfree(iov);
> +	}

While you touch this:  I think thi block of code would also be a good
separate helper.  Maybe even in the block layer given the the scsi
ioctl code and sg duplicate it, and already missed the fast_iov
treatment due to the duplication.  Having this in a separate function
is also nice to keep the fast_iov stack footprint isolated.

> +	if (ret)
> +		goto out;
> +	bio = req->bio;

I think we can also do away with this bio local variable now.

> +	if (bdev)
> +		bio_set_dev(bio, bdev);

We don't need the bio_set_dev here as mentioned last time, so I think
we should remove it in a prep patch.

> +		ret = nvme_map_user_request(req, ubuffer, bufflen, meta_buffer,
> +			meta_len, meta_seed, &meta, vec);

Nit: Add an extra tab for indentation here please.

>  	if (IS_ERR(req))
>  		return PTR_ERR(req);
> +	req->timeout = d.timeout_ms ? msecs_to_jiffies(d.timeout_ms) : 0;

	if (d.timeout_ms)
		req->timeout = msecs_to_jiffies(d.timeout_ms);


  reply	other threads:[~2022-09-23 15:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220923093906epcas5p1308a262f3de722a923339c2e804fc5ee@epcas5p1.samsung.com>
2022-09-23  9:28 ` [PATCH for-next v8 0/5] fixed-buffer for uring-cmd/passthru Kanchan Joshi
     [not found]   ` <CGME20220923093910epcas5p2624d93c6cb5caebb5f9203a1b8f4f5b1@epcas5p2.samsung.com>
2022-09-23  9:28     ` [PATCH for-next v8 1/5] io_uring: add io_uring_cmd_import_fixed Kanchan Joshi
     [not found]   ` <CGME20220923093913epcas5p4d91766a750d6f5e87a1da0b92f6c4a2e@epcas5p4.samsung.com>
2022-09-23  9:28     ` [PATCH for-next v8 2/5] io_uring: introduce fixed buffer support for io_uring_cmd Kanchan Joshi
     [not found]   ` <CGME20220923093916epcas5p387fdd905413f6d90babecf5d14da5b67@epcas5p3.samsung.com>
2022-09-23  9:28     ` [PATCH for-next v8 3/5] nvme: refactor nvme_alloc_user_request Kanchan Joshi
2022-09-23 15:38       ` Christoph Hellwig [this message]
2022-09-25 17:39         ` Kanchan Joshi
2022-09-25 19:43         ` Kanchan Joshi
2022-09-26 14:51           ` Christoph Hellwig
2022-09-27 16:57             ` Kanchan Joshi
     [not found]   ` <CGME20220923093919epcas5p3d019fa1db990101478b8d6673ac0eaa6@epcas5p3.samsung.com>
2022-09-23  9:28     ` [PATCH for-next v8 4/5] block: add helper to map bvec iterator for passthrough Kanchan Joshi
2022-09-23 15:30       ` Christoph Hellwig
     [not found]   ` <CGME20220923093924epcas5p1e1723a3937cb3331c77e55bd1a785e57@epcas5p1.samsung.com>
2022-09-23  9:28     ` [PATCH for-next v8 5/5] nvme: wire up fixed buffer support for nvme passthrough Kanchan Joshi
2022-09-23 15:40       ` Christoph Hellwig
2022-09-23 14:15   ` [PATCH for-next v8 0/5] fixed-buffer for uring-cmd/passthru Jens Axboe
2022-09-25 17:56     ` Kanchan Joshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox