linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kanchan Joshi <joshi.k@samsung.com>
To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org,
	linux-ext4@vger.kernel.org
Cc: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com,
	joshiiitr@gmail.com, Kanchan Joshi <joshi.k@samsung.com>
Subject: [PATCH v3 4/7] nvme: register stream info with block layer
Date: Fri, 29 Mar 2019 13:23:49 +0530	[thread overview]
Message-ID: <1553846032-4451-5-git-send-email-joshi.k@samsung.com> (raw)
In-Reply-To: <1553846032-4451-1-git-send-email-joshi.k@samsung.com>

nvme registes number of streams with block layer, which will use that
for write-hint to streamid conversion. Registration is done for each
namespace. Since NVMe spec allow all available streams (within subsystem)
to be used by all namespaces, no attempt has been made to add reservation
at namespace level.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 drivers/nvme/host/core.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 150e497..e34386b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -513,14 +513,7 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
 		return ret;
 
 	ctrl->nssa = le16_to_cpu(s.nssa);
-	if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) {
-		dev_info(ctrl->device, "too few streams (%u) available\n",
-					ctrl->nssa);
-		nvme_disable_streams(ctrl);
-		return 0;
-	}
-
-	ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1);
+	ctrl->nr_streams = ctrl->nssa;
 	dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams);
 	return 0;
 }
@@ -533,12 +526,9 @@ static void nvme_assign_write_stream(struct nvme_ctrl *ctrl,
 				     struct request *req, u16 *control,
 				     u32 *dsmgmt)
 {
-	enum rw_hint streamid = req->write_hint;
+	enum rw_hint streamid = req->streamid;
 
-	if (streamid == WRITE_LIFE_NOT_SET || streamid == WRITE_LIFE_NONE)
-		streamid = 0;
-	else {
-		streamid--;
+	if (streamid != 0) {
 		if (WARN_ON_ONCE(streamid > ctrl->nr_streams))
 			return;
 
@@ -3138,6 +3128,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
 {
 	struct streams_directive_params s;
 	int ret;
+	u16 nr_streams;
 
 	if (!ctrl->nr_streams)
 		return 0;
@@ -3149,6 +3140,8 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
 	ns->sws = le32_to_cpu(s.sws);
 	ns->sgs = le16_to_cpu(s.sgs);
 
+	nr_streams = min_t(unsigned, ctrl->nr_streams, BLK_MAX_WRITE_HINTS - 1);
+	blk_queue_stream_limits(ns->queue, nr_streams);
 	if (ns->sws) {
 		unsigned int bs = 1 << ns->lba_shift;
 
-- 
2.7.4


  parent reply	other threads:[~2019-03-29  7:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190329075737epcas1p4f32cad26279c1146982a6c91b3378eab@epcas1p4.samsung.com>
2019-03-29  7:53 ` [PATCH v3 0/7] Extend write-hint for in-kernel use Kanchan Joshi
     [not found]   ` <CGME20190329075743epcas1p12f1d290e65ddf84eb74ed94a5ae6eb74@epcas1p1.samsung.com>
2019-03-29  7:53     ` [PATCH v3 1/7] block: extend stream count " Kanchan Joshi
2019-03-30 17:48       ` Andreas Dilger
2019-04-01  5:02       ` Dave Chinner
     [not found]   ` <CGME20190329075746epcas1p19e5a93c1f593b5fed3f98eddf9159aa5@epcas1p1.samsung.com>
2019-03-29  7:53     ` [PATCH v3 2/7] block: introduce API to register stream information with block layer Kanchan Joshi
     [not found]   ` <CGME20190329075749epcas2p22b85cbdbb7ccb4f7f3ecf69b84f75dc9@epcas2p2.samsung.com>
2019-03-29  7:53     ` [PATCH v3 3/7] block: add write-hint to stream-id conversion Kanchan Joshi
2019-04-01  5:08       ` Dave Chinner
2019-04-02  9:20         ` Jan Kara
2019-04-02 20:35           ` Dave Chinner
2019-04-03  9:36             ` Jan Kara
2019-04-03 14:47               ` kanchan
     [not found]   ` <CGME20190329075753epcas1p16ce37362f83ccb8520a782b845dcb905@epcas1p1.samsung.com>
2019-03-29  7:53     ` Kanchan Joshi [this message]
2019-03-29 16:58       ` [PATCH v3 4/7] nvme: register stream info with block layer Heitke, Kenneth
     [not found]   ` <CGME20190329075755epcas2p2d2670db217ae3519d2c4b93d5e3749d1@epcas2p2.samsung.com>
2019-03-29  7:53     ` [PATCH v3 5/7] fs: introduce APIs to enable sending write-hint with buffer-head Kanchan Joshi
     [not found]   ` <CGME20190329075758epcas1p335511dcb10bb5592ea72409a1d01e752@epcas1p3.samsung.com>
2019-03-29  7:53     ` [PATCH v3 6/7] fs: introduce write-hint start point for in-kernel hints Kanchan Joshi
2019-04-01  5:12       ` Dave Chinner
2019-04-03 14:30         ` kanchan
     [not found]   ` <CGME20190329075800epcas2p4731f10eabf7d70dc7096117d161b05a3@epcas2p4.samsung.com>
2019-03-29  7:53     ` [PATCH v3 7/7] fs/ext4,jbd2: add support for passing write-hint with journal Kanchan Joshi
2019-03-30 17:49       ` Andreas Dilger
2019-04-02  9:07         ` Jan Kara
2019-04-03  2:57       ` Martin K. Petersen
2019-04-03 13:42         ` kanchan

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=1553846032-4451-5-git-send-email-joshi.k@samsung.com \
    --to=joshi.k@samsung.com \
    --cc=anshul@samsung.com \
    --cc=axboe@fb.com \
    --cc=joshiiitr@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=prakash.v@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).