Skip to contentSkip to conversation

nbd: set the max segment size to UINT_MAX

PATCH In review Josef Bacik 3 participants 3 messages Apr 18, 2017 – Apr 19, 2017

Subsystems (2)
lore
Share & tools
lore

Josef Bacik

author maintainer
#0 lore raw

PATCH 1/1 nbd: set the max segment size to UINT_MAX

NBD doesn't care about limiting the segment size, let the user push the largest bio's they want. This allows us to control the request size solely through max_sectors_kb.

---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
index b78f23c..6e592c2 100644
@@ -1469,6 +1469,7 @@ static int nbd_dev_add(int index)
 	queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	disk->queue->limits.discard_granularity = 512;
 	blk_queue_max_discard_sectors(disk->queue, UINT_MAX);
+	blk_queue_max_segment_size(disk->queue, UINT_MAX);
 	blk_queue_max_hw_sectors(disk->queue, 65536);
 	disk->queue->limits.max_sectors = 256;
 
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Josef Bacik

NBD doesn't care about limiting the segment size, let the user push the largest bio's they want. This allows us to control the request size solely through max_sectors_kb.

---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/block/nbd.c +0 -0
index b78f23c..6e592c2 100644

drivers/block/nbd.c static int nbd_dev_add(int index) · line 1474

Quoted 6 lines
drivers/block/nbd.c +1 -0
@@ -1469,6 +1469,7 @@ static int nbd_dev_add(int index)
        queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, disk->queue);
        disk->queue->limits.discard_granularity = 512;
        blk_queue_max_discard_sectors(disk->queue, UINT_MAX);
+       blk_queue_max_segment_size(disk->queue, UINT_MAX);
        blk_queue_max_hw_sectors(disk->queue, 65536);
        disk->queue->limits.max_sectors = 256;

The change is fine, since the segment size limit should be from hw itself.

Thanks,
Ming Lei

#2 lore raw
In reply to Josef Bacik
Quoted 3 lines · Josef Bacik

NBD doesn't care about limiting the segment size, let the user push the largest bio's they want. This allows us to control the request size solely through max_sectors_kb.

Thanks Josef, applied for 4.12.

Signature · 1 line
Jens Axboe