nvmet-file: clamp-down file namespace lba_shift
Subsystems (2)
Sagi Grimberg
maintainerPATCH v2 1/1 nvmet-file: clamp-down file namespace lba_shift
When the backing file is a tempfile for example, the inode i_blkbits can be 1M in size which causes problems for hosts to support as the disk block size.
Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
Changes from v1:
- don't cross 80 char limit
drivers/nvme/target/io-cmd-file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/io-cmd-file.c +2 -1
@@ -49,7 +49,8 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) goto err; ns->size = stat.size; - ns->blksize_shift =file_inode (ns->file)->i_blkbits; + ns->blksize_shift =min_t (u8, +file_inode (ns->file)->i_blkbits,PAGE_SHIFT ); ns->bvec_cache = kmem_cache_create("nvmet-bvec", NVMET_MAX_MPOOL_BVEC * sizeof(struct bio_vec),
Signature · 1 line
2.17.1
Christoph Hellwig
maintainerPATCH v2 1/1 nvmet-file: clamp-down file namespace lba_shift
Quoted 3 lines · Sagi Grimberg
When the backing file is a tempfile for example, the inode
i_blkbitscan be 1M in size which causes problems for hosts to support as the disk block size.
Can you please look into the other review comments as well?
Also this will need a code comment describing why we do this clamping.