block size limit cleanups
Subsystems (4)
cover block size limit cleanups
This spins off two change which introduces no functional changes from the bs > ps block device patch series [0]. These are just cleanups.
[0] https://lkml.kernel.org/r/[email protected]
Luis Chamberlain (2):
block/bdev: use helper for max block size check
nvme: use blk_validate_block_size() for max LBA check
block/bdev.c | 3 +-- drivers/nvme/host/core.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 block/bdev: use helper for max block size check
We already have a helper for checking the limits on the block size both low and high, just use that.
No functional changes.
--- block/bdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/bdev.c +1 -2
@@ -155,8 +155,7 @@ int set_blocksize(struct file *file, int size)struct inode *inode = file->f_mapping->host;struct block_device *bdev =I_BDEV (inode); -/* Size must be a power of two, and between 512 and PAGE_SIZE */ -if (size >PAGE_SIZE || size <512 || !is_power_of_2 (size)) +if (blk_validate_block_size (size))return -EINVAL ;/* Size cannot be smaller than the size supported by the device */
Signature · 1 line
2.43.0
PATCH 2/2 nvme: use blk_validate_block_size() for max LBA check
In reply to Luis ChamberlainThe block layer already has support to validates proper block sizes with blk_validate_block_size(), we can leverage that as well.
No functional changes.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -2034,7 +2034,7 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,* 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 ) { +if (blk_validate_block_size (bs)) { bs = (1 <<9 ); valid = false; }
Signature · 1 line
2.43.0
Re: [PATCH 2/2] nvme: use blk_validate_block_size() for max LBA check
On 18/12/2024 02:02, Luis Chamberlain wrote:
nit: is this really an LBA check?
Quoted 6 lines
The block layer already has support to validates proper block sizes with
blk_validate_block_size(), we can leverage that as well.No functional changes.
Signed-off-by Luis Chamberlain <[email protected]>
Most of my comments are minor/off topic, so:
drivers/nvme/host/core.c static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id, · line 2035
Quoted 11 lines
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/host/core.c +0
-0@@ -2034,7 +2034,7 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,* or smaller than a sector size yet, so catch this early and don't * allow block I/O.
I'm not sure if this comment is really still of value or can be reduced
drivers/nvme/host/core.c static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id, · line 2037
Quoted 3 lines
drivers/nvme/host/core.c +1
-1*/ -if (head->lba_shift >PAGE_SHIFT || head->lba_shift <SECTOR_SHIFT ) { +if (blk_validate_block_size (bs)) {
There was only a single user of this outside the block layer, and I was hoping that this function could eventually be internalized - not any longer.
drivers/nvme/host/core.c static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id, · line 2038
Quoted 1 line
drivers/nvme/host/core.c +0
-0bs = (1 <<9 );
comment on original code:
bs = SECTOR_SIZE
seems more obvious
Quoted 2 lines
drivers/nvme/host/core.c +0
-0valid = false; }
Quoted 2 lines · Luis Chamberlain
This spins off two change which introduces no functional changes from the bs > ps block device patch series [0]. These are just cleanups.
Looks good.
Looks good:
(the CC list feels a little excessive, though)
Quoted 10 lines · Luis Chamberlain
This spins off two change which introduces no functional changes from the bs > ps block device patch series [0]. These are just cleanups.
[0] https://lkml.kernel.org/r/[email protected]
Luis Chamberlain (2):
block/bdev: use helper for max block size check
nvme: useblk_validate_block_size()for max LBA check[...]
Applied, thanks!
[1/2] block/bdev: use helper for max block size check
commit: 26fff8a4432ffd03409346b7dae1e1a2c5318b7c
[2/2] nvme: use blk_validate_block_size() for max LBA check
commit: 51588b1b77b65cd0fb3440f78f37bef7178a2715Best regards,
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 11 lines · Jens Axboe
Quoted 9 lines · Luis Chamberlain
This spins off two change which introduces no functional changes from the bs > ps block device patch series [0]. These are just cleanups.
[0] https://lkml.kernel.org/r/[email protected]
Luis Chamberlain (2):
block/bdev: use helper for max block size check
nvme: useblk_validate_block_size()for max LBA check
Quoted 8 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] block/bdev: use helper for max block size check
commit: 26fff8a4432ffd03409346b7dae1e1a2c5318b7c [2/2] nvme: use blk_validate_block_size() for max LBA check commit: 51588b1b77b65cd0fb3440f78f37bef7178a2715
JFYI, gmail puts all your emails into spam, because it can't authenticate them. This seemingly happens to everybody that uses kernel.org as the email, if they haven't updated to the newer setup. You should fix it, I only saw the emails because others replied.
And please trim the way excessive CC lists on patches like this. Cleanups don't need to go to tons of unrelated lists or people.
Signature · 1 line
Jens Axboe
Quoted 5 lines · Luis Chamberlain
This spins off two change which introduces no functional changes from the bs > ps block device patch series [0]. These are just cleanups.
Quoted 7 lines
Luis Chamberlain (2):
block/bdev: use helper for max block size check
nvme: useblk_validate_block_size()for max LBA checkblock/bdev.c | 3 +-- drivers/nvme/host/core.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
Looks good,