[PATCH-part-2 9/9] nvme: force sgls on user passthrough if possible
Keith Busch
kbusch at kernel.org
Wed Sep 4 12:23:58 PDT 2024
On Wed, Sep 04, 2024 at 11:38:17AM -0700, Keith Busch wrote:
> @@ -146,6 +156,13 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
> if (bdev) {
> bio_set_dev(bio, bdev);
> if (meta_buffer && meta_len) {
> + if (nvme_ctrl_meta_sgl_supported(ctrl)) {
> + nvme_req(req)->flags |= NVME_REQ_USE_META_SGLS;
> + } else {
> + dev_warn_once(ctrl->device,
> + "using unchecked meta buffer\n");
> + add_taint(TAINT_USER, LOCKDEP_STILL_OK);
> + }
> ret = bio_integrity_map_user(bio, meta_buffer, meta_len,
> meta_seed);
> if (ret)
This actually needs to add this line on successful:
req->nr_integrity_segments = bio_integrity(bio)->bip_vcnt;
But it think it would be even better to introce a request helper,
blk_integrity_map_user() that takes a struct instead of a bio so it can
handle updating the request state appropriately.
More information about the Linux-nvme
mailing list