Skip to contentSkip to conversation

nvmet: lift blocksize restriction to 64k

PATCH In review Hannes Reinecke 3 participants 5 messages Feb 20 – Feb 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvmet: lift blocksize restriction to 64k

With commit 47dd67532303 ("block/bdev: lift block size restrictions to 64k") we can now support up to 64k block sizes, so lift the restriction on 4k for file-backed namespaces.

Fixes 47dd67532303 ("block/bdev: lift block size restrictions to 64k")
---
 drivers/nvme/target/io-cmd-file.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/nvme/target/io-cmd-file.c +2 -3
index 2d068439b129..fdc15c59632f 100644
@@ -50,11 +50,10 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
 	nvmet_file_ns_revalidate(ns);
 
 	/*
-	 * i_blkbits can be greater than the universally accepted upper bound,
-	 * so make sure we export a sane namespace lba_shift.
+	 * We can support blocksizes up to 64k.
 	 */
 	ns->blksize_shift = min_t(u8,
-			file_inode(ns->file)->i_blkbits, 12);
+			file_inode(ns->file)->i_blkbits, ilog2(SZ_64K));
 
 	ns->bvec_pool = mempool_create(NVMET_MIN_MPOOL_OBJ, mempool_alloc_slab,
 			mempool_free_slab, nvmet_bvec_cache);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Hannes Reinecke

With commit 47dd67532303 ("block/bdev: lift block size restrictions to 64k") we can now support up to 64k block sizes, so lift the restriction on 4k for file-backed namespaces.

Still not sure this is a great idea by default. Yes, modern Linux supports 64k sector sizes, but even then just for a few file systems. And this changes existing setups, which will now break when upgrading the kernel.

This needs an opt-in.

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke

With commit 47dd67532303 ("block/bdev: lift block size restrictions to 64k") we can now support up to 64k block sizes, so lift the restriction on 4k for file-backed namespaces.

Still not sure this is a great idea by default. Yes, modern Linux supports 64k sector sizes, but even then just for a few file systems. And this changes existing setups, which will now break when upgrading the kernel.

How so? There cannot be any existing nvmet setup with an LBS backing device, as the device will be rejected when trying to setup the target. Which breakage do you see here?

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
#3 lore raw
Quoted 6 lines · Hannes Reinecke
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke

With commit 47dd67532303 ("block/bdev: lift block size restrictions to 64k") we can now support up to 64k block sizes, so lift the restriction on 4k for file-backed namespaces.

Quoted 7 lines
Quoted 4 lines

Still not sure this is a great idea by default. Yes, modern Linux supports 64k sector sizes, but even then just for a few file systems. And this changes existing setups, which will now break when upgrading the kernel.

How so? There cannot be any existing nvmet setup with an LBS backing device, as the device will be rejected when trying to setup the target. Which breakage do you see here?

There can be a setup with a large i_blkbits that we limit to 4k export LBA size right now, and with your patch it will be exposed as something larger.

#4 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · Hannes Reinecke
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke

With commit 47dd67532303 ("block/bdev: lift block size restrictions to 64k") we can now support up to 64k block sizes, so lift the restriction on 4k for file-backed namespaces.

Still not sure this is a great idea by default. Yes, modern Linux supports 64k sector sizes, but even then just for a few file systems. And this changes existing setups, which will now break when upgrading the kernel.

Quoted 8 lines
Quoted 3 lines

How so? There cannot be any existing nvmet setup with an LBS backing device, as the device will be rejected when trying to setup the target. Which breakage do you see here?

There can be a setup with a large i_blkbits that we limit to 4k export LBA size right now, and with your patch it will be exposed as something larger.

True.
Hmm. Okay, I'll work on something.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich