public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Derrick <jonathan.derrick@intel.com>
To: axboe@fb.com
Cc: linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org,
	linux-block@vger.kernel.org, keith.busch@intel.com,
	hch@infradead.org, sagi@grimberg.me,
	Jon Derrick <jonathan.derrick@intel.com>
Subject: [PATCH] nvme/scsi: Consider LBA format in IO splitting calculation
Date: Mon, 24 Apr 2017 18:02:43 -0600	[thread overview]
Message-ID: <20170425000243.2019-1-jonathan.derrick@intel.com> (raw)

The current command submission code uses a sector-based value when
considering the maximum number of blocks per command. With a
4k-formatted namespace and a command exceeding max hardware limits, this
calculation doesn't split IOs which should be split and fails in the
nvme layer. This patch fixes that calculation and enables IO splitting
in these circumstances.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
---
 drivers/nvme/host/scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c
index f49ae27..988da61 100644
--- a/drivers/nvme/host/scsi.c
+++ b/drivers/nvme/host/scsi.c
@@ -1609,7 +1609,7 @@ static int nvme_trans_do_nvme_io(struct nvme_ns *ns, struct sg_io_hdr *hdr,
 	struct nvme_command c;
 	u8 opcode = (is_write ? nvme_cmd_write : nvme_cmd_read);
 	u16 control;
-	u32 max_blocks = queue_max_hw_sectors(ns->queue);
+	u32 max_blocks = queue_max_hw_sectors(ns->queue) >> (ns->lba_shift - 9);
 
 	num_cmds = nvme_trans_io_get_num_cmds(hdr, cdb_info, max_blocks);
 
-- 
2.9.3

             reply	other threads:[~2017-04-25  0:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  0:02 Jon Derrick [this message]
2017-04-25  4:00 ` [PATCH] nvme/scsi: Consider LBA format in IO splitting calculation Jens Axboe
2017-04-25  4:27   ` Damien Le Moal
2017-04-25  4:32     ` Jens Axboe
2017-04-25  4:43       ` Damien Le Moal
2017-04-25 17:57 ` 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=20170425000243.2019-1-jonathan.derrick@intel.com \
    --to=jonathan.derrick@intel.com \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sagi@grimberg.me \
    /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