Skip to content

Commit 6e9429f

Browse files
Christoph Hellwiggregkh
authored andcommitted
null_blk: don't cap max_hw_sectors to BLK_DEF_MAX_SECTORS
[ Upstream commit 9a9525d ] null_blk has some rather odd capping of the max_hw_sectors value to BLK_DEF_MAX_SECTORS, which doesn't make sense - max_hw_sector is the hardware limit, and BLK_DEF_MAX_SECTORS despite the confusing name is the default cap for the max_sectors field used for normal file system I/O. Remove all the capping, and simply leave it to the block layer or user to take up or not all of that for file system I/O. Fixes: ea17fd3 ("null_blk: Allow controlling max_hw_sectors limit") Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20231227092305.279567-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a623d31 commit 6e9429f

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

drivers/block/null_blk/main.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,10 +2114,8 @@ static int null_add_dev(struct nullb_device *dev)
21142114

21152115
blk_queue_logical_block_size(nullb->q, dev->blocksize);
21162116
blk_queue_physical_block_size(nullb->q, dev->blocksize);
2117-
if (!dev->max_sectors)
2118-
dev->max_sectors = queue_max_hw_sectors(nullb->q);
2119-
dev->max_sectors = min(dev->max_sectors, BLK_DEF_MAX_SECTORS);
2120-
blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
2117+
if (dev->max_sectors)
2118+
blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
21212119

21222120
if (dev->virt_boundary)
21232121
blk_queue_virt_boundary(nullb->q, PAGE_SIZE - 1);
@@ -2217,12 +2215,6 @@ static int __init null_init(void)
22172215
g_bs = PAGE_SIZE;
22182216
}
22192217

2220-
if (g_max_sectors > BLK_DEF_MAX_SECTORS) {
2221-
pr_warn("invalid max sectors\n");
2222-
pr_warn("defaults max sectors to %u\n", BLK_DEF_MAX_SECTORS);
2223-
g_max_sectors = BLK_DEF_MAX_SECTORS;
2224-
}
2225-
22262218
if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
22272219
pr_err("invalid home_node value\n");
22282220
g_home_node = NUMA_NO_NODE;

0 commit comments

Comments
 (0)