diff mbox series

[RFC,v2,10/11] nvme: remove superfluous block size check

Message ID 20241214031050.1337920-11-mcgrof@kernel.org (mailing list archive)
State New
Headers show
Series enable bs > ps for block devices | expand

Commit Message

Luis Chamberlain Dec. 14, 2024, 3:10 a.m. UTC
The block layer already validates proper block sizes with
blk_validate_block_size() for us so we can remove this now
superfluous check.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/nvme/host/core.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Matthew Wilcox (Oracle) Dec. 15, 2024, 12:39 a.m. UTC | #1
On Fri, Dec 13, 2024 at 07:10:48PM -0800, Luis Chamberlain wrote:
> The block layer already validates proper block sizes with
> blk_validate_block_size() for us so we can remove this now
> superfluous check.

If this patch were correct, it couldn't go far enough ("valid" is now
only assigned true, so it can be removed and the function could return
void, etc).

But I think there's still utility in checking the current configuration
to see if it can be supported by the block layer, and setting capacity
to 0 if it's not (so that the namespace can be reconfigured).
diff mbox series

Patch

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d169a30eb935..bbb5e9d2415c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2029,16 +2029,6 @@  static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
 	u32 atomic_bs, phys_bs, io_opt = 0;
 	bool valid = true;
 
-	/*
-	 * The block layer can't support LBA sizes larger than the page size
-	 * or smaller than a sector size yet, so catch this early and don't
-	 * allow block I/O.
-	 */
-	if (head->lba_shift > PAGE_SHIFT || head->lba_shift < SECTOR_SHIFT) {
-		bs = (1 << 9);
-		valid = false;
-	}
-
 	atomic_bs = phys_bs = bs;
 	if (id->nabo == 0) {
 		/*