public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@samsung.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	"Christoph Hellwig" <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>
Cc: Pankaj Raghav <p.raghav@samsung.com>,
	"mcgrof@kernel.org" <mcgrof@kernel.org>,
	Daniel Gomez <da.gomez@samsung.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] nvme: Increase block size variable size to 32-bit
Date: Tue, 30 May 2023 15:42:53 +0000	[thread overview]
Message-ID: <20230530154231.8313-1-da.gomez@samsung.com> (raw)
In-Reply-To: CGME20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c@eucas1p2.samsung.com

Increase block size variable size to 32-bit unsigned to be able to
support block devices larger than 32k (starting from 64 KiB).

Physical and logical block size already support unsigned 32-bit.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---

While experimenting and doing code inspection for large block
devices, we found a limitation of a 32 KiB block size due to the bs
variable type. With that limitation and in combination with a large
block device, this results in a kernel BUG when the block layer
attempts to split a block size of 0 bytes.

Increasing the value to 32-bit unsigned, allows to support large block
devices starting from 64 KiB. In addition, this bs variable type
aligns with the queue_limits logical/physical_block_size types.


 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 151b23400ada..b4bc48f2a011 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1835,7 +1835,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
 		struct nvme_ns *ns, struct nvme_id_ns *id)
 {
 	sector_t capacity = nvme_lba_to_sect(ns, le64_to_cpu(id->nsze));
-	unsigned short bs = 1 << ns->lba_shift;
+	u32 bs = 1 << ns->lba_shift;
 	u32 atomic_bs, phys_bs, io_opt = 0;

 	/*
--
2.40.1


       reply	other threads:[~2023-05-30 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c@eucas1p2.samsung.com>
2023-05-30 15:42 ` Daniel Gomez [this message]
2023-05-30 16:24   ` [PATCH] nvme: Increase block size variable size to 32-bit Luis Chamberlain
2023-05-30 17:27   ` Keith Busch
2023-05-31 13:03   ` Christoph Hellwig
2023-06-01 10:28     ` David Laight
2023-06-01 17:10     ` Keith Busch

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=20230530154231.8313-1-da.gomez@samsung.com \
    --to=da.gomez@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    --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