Skip to content

Commit 9a9525d

Browse files
Christoph Hellwigaxboe
authored andcommitted
null_blk: don't cap max_hw_sectors to BLK_DEF_MAX_SECTORS
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>
1 parent 34c7db4 commit 9a9525d

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
@@ -2186,10 +2186,8 @@ static int null_add_dev(struct nullb_device *dev)
21862186

21872187
blk_queue_logical_block_size(nullb->q, dev->blocksize);
21882188
blk_queue_physical_block_size(nullb->q, dev->blocksize);
2189-
if (!dev->max_sectors)
2190-
dev->max_sectors = queue_max_hw_sectors(nullb->q);
2191-
dev->max_sectors = min(dev->max_sectors, BLK_DEF_MAX_SECTORS);
2192-
blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
2189+
if (dev->max_sectors)
2190+
blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
21932191

21942192
if (dev->virt_boundary)
21952193
blk_queue_virt_boundary(nullb->q, PAGE_SIZE - 1);
@@ -2289,12 +2287,6 @@ static int __init null_init(void)
22892287
g_bs = PAGE_SIZE;
22902288
}
22912289

2292-
if (g_max_sectors > BLK_DEF_MAX_SECTORS) {
2293-
pr_warn("invalid max sectors\n");
2294-
pr_warn("defaults max sectors to %u\n", BLK_DEF_MAX_SECTORS);
2295-
g_max_sectors = BLK_DEF_MAX_SECTORS;
2296-
}
2297-
22982290
if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
22992291
pr_err("invalid home_node value\n");
23002292
g_home_node = NUMA_NO_NODE;

0 commit comments

Comments
 (0)