All of lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 2/8] nvme: use the block layer for userspace	passthrough metadata
Date: Thu, 15 Oct 2015 14:44:02 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LNX.2.00.1510151442300.27742@localhost.lm.intel.com> (raw)
In-Reply-To: <20151015052732.GA21725@lst.de>

There's not much, so here's all the fixes for the whole series in
one diff:

---
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f056513..eb9e25a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -139,6 +139,7 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd,
  {
  	bool write = cmd->common.opcode & 1;
  	struct request *req;
+	struct nvme_ns *ns = q->queuedata;
  	struct bio *bio = NULL;
  	void *meta = NULL;
  	int ret;
@@ -156,6 +157,11 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd,
  			goto out;
  		bio = req->bio;

+		bio->bi_bdev = bdget_disk(ns->disk, 0);
+		if (!bio->bi_bdev) {
+			ret = -ENODEV;
+			goto out_unmap;
+		}
  		if (meta_buffer) {
  			struct bio_integrity_payload *bip;

@@ -188,10 +194,11 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd,
  				ret = -ENOMEM;
  				goto out_free_meta;
  			}
+			req->cmd_flags |= REQ_INTEGRITY;
  		}
  	}

-	blk_execute_rq(req->q, NULL, req, 0);
+	blk_execute_rq(req->q, ns->disk, req, 0);
  	ret = req->errors;
  	if (result)
  		*result = (u32)(uintptr_t)req->special;
@@ -203,8 +210,11 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd,
   out_free_meta:
  	kfree(meta);
   out_unmap:
-	if (bio)
+	if (bio) {
+		if (bio->bi_bdev)
+			bdput(bio->bi_bdev);
  		blk_rq_unmap_user(bio);
+	}
   out:
  	blk_mq_free_request(req);
  	return ret;
@@ -958,7 +968,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
  		goto out_release_instance;
  	}
  	get_device(ctrl->device);
-	dev_set_drvdata(ctrl->device, dev);
+	dev_set_drvdata(ctrl->device, ctrl);

  	ret = device_create_file(ctrl->device, &dev_attr_reset_controller);
  	if (ret)
@@ -1011,7 +1011,7 @@ int __init nvme_core_init(void)
  	return result;
  }

-void __exit nvme_core_exit(void)
+void nvme_core_exit(void)
  {
  	unregister_blkdev(nvme_major, "nvme");
  	class_destroy(nvme_class);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 5d45ca2..45bea69 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -164,6 +164,6 @@ int nvme_sg_io32(struct nvme_ns *ns, unsigned long arg);
  int nvme_sg_get_version_num(int __user *ip);

  int __init nvme_core_init(void);
-void __exit nvme_core_exit(void);
+void nvme_core_exit(void);

  #endif /* _NVME_H */
--

  reply	other threads:[~2015-10-15 14:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12  7:10 RFC: nvme driver split, the main part Christoph Hellwig
2015-10-12  7:10 ` [PATCH 1/8] nvme: split __nvme_submit_sync_cmd Christoph Hellwig
2015-10-12  7:10 ` [PATCH 2/8] nvme: use the block layer for userspace passthrough metadata Christoph Hellwig
2015-10-14 21:19   ` Keith Busch
2015-10-14 21:23     ` Busch, Keith
2015-10-15  5:27     ` Christoph Hellwig
2015-10-15 14:44       ` Keith Busch [this message]
2015-10-15 14:58         ` Christoph Hellwig
2015-10-12  7:10 ` [PATCH 3/8] nvme: move block_device_operations and ns/ctrl freeing to common code Christoph Hellwig
2015-10-12  7:10 ` [PATCH 4/8] nvme: add explicit quirk handling Christoph Hellwig
2015-10-12  7:10 ` [PATCH 5/8] nvme: add a common helper to read Identify Controller data Christoph Hellwig
2015-10-12  7:10 ` [PATCH 6/8] nvme: move the call to nvme_init_identify earlier Christoph Hellwig
2015-10-12  7:10 ` [PATCH 7/8] nvme: move namespace scanning to common code Christoph Hellwig
2015-10-13 19:31   ` Keith Busch
2015-10-14 12:53     ` Christoph Hellwig
2015-10-12  7:10 ` [PATCH 8/8] nvme: move chardev and sysfs interface " Christoph Hellwig
2015-10-14 16:03   ` Keith Busch
2015-10-13 23:23 ` RFC: nvme driver split, the main part Ming Lin
2015-10-14 12:58   ` Christoph Hellwig

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 \
    --in-reply-to=alpine.LNX.2.00.1510151442300.27742@localhost.lm.intel.com \
    --to=keith.busch@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.