Skip to content

Commit e16344e

Browse files
Christoph Hellwigaxboe
authored andcommitted
drbd: merge drbd_setup_queue_param into drbd_reconsider_queue_parameters
drbd_setup_queue_param is only called by drbd_reconsider_queue_parameters and there is no really clear boundary of responsibilities between the two. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Philipp Reisner <[email protected]> Reviewed-by: Lars Ellenberg <[email protected]> Tested-by: Christoph Böhmwalder <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2828908 commit e16344e

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

drivers/block/drbd/drbd_nl.c

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,45 +1309,16 @@ static unsigned int drbd_backing_dev_max_segments(struct drbd_device *device)
13091309
return max_segments;
13101310
}
13111311

1312-
static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backing_dev *bdev,
1313-
unsigned int max_bio_size, struct o_qlim *o)
1314-
{
1315-
struct request_queue * const q = device->rq_queue;
1316-
unsigned int max_hw_sectors = max_bio_size >> 9;
1317-
unsigned int max_segments = BLK_MAX_SEGMENTS;
1318-
struct request_queue *b = NULL;
1319-
1320-
if (bdev) {
1321-
b = bdev->backing_bdev->bd_disk->queue;
1322-
1323-
max_hw_sectors = min(queue_max_hw_sectors(b), max_bio_size >> 9);
1324-
max_segments = drbd_backing_dev_max_segments(device);
1325-
1326-
blk_set_stacking_limits(&q->limits);
1327-
}
1328-
1329-
blk_queue_max_hw_sectors(q, max_hw_sectors);
1330-
blk_queue_max_segments(q, max_segments);
1331-
blk_queue_segment_boundary(q, PAGE_SIZE-1);
1332-
decide_on_discard_support(device, bdev);
1333-
1334-
if (b) {
1335-
blk_stack_limits(&q->limits, &b->limits, 0);
1336-
disk_update_readahead(device->vdisk);
1337-
}
1338-
fixup_write_zeroes(device, q);
1339-
fixup_discard_support(device, q);
1340-
}
1341-
13421312
void drbd_reconsider_queue_parameters(struct drbd_device *device,
13431313
struct drbd_backing_dev *bdev, struct o_qlim *o)
13441314
{
1345-
unsigned int now = queue_max_hw_sectors(device->rq_queue) <<
1346-
SECTOR_SHIFT;
1315+
struct request_queue * const q = device->rq_queue;
1316+
unsigned int now = queue_max_hw_sectors(q) << 9;
1317+
struct request_queue *b = NULL;
13471318
unsigned int new;
13481319

13491320
if (bdev) {
1350-
struct request_queue *b = bdev->backing_bdev->bd_disk->queue;
1321+
b = bdev->backing_bdev->bd_disk->queue;
13511322

13521323
device->local_max_bio_size =
13531324
queue_max_hw_sectors(b) << SECTOR_SHIFT;
@@ -1369,7 +1340,24 @@ void drbd_reconsider_queue_parameters(struct drbd_device *device,
13691340
drbd_info(device, "max BIO size = %u\n", new);
13701341
}
13711342

1372-
drbd_setup_queue_param(device, bdev, new, o);
1343+
if (bdev) {
1344+
blk_set_stacking_limits(&q->limits);
1345+
blk_queue_max_segments(q,
1346+
drbd_backing_dev_max_segments(device));
1347+
} else {
1348+
blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
1349+
}
1350+
1351+
blk_queue_max_hw_sectors(q, new >> SECTOR_SHIFT);
1352+
blk_queue_segment_boundary(q, PAGE_SIZE - 1);
1353+
decide_on_discard_support(device, bdev);
1354+
1355+
if (bdev) {
1356+
blk_stack_limits(&q->limits, &b->limits, 0);
1357+
disk_update_readahead(device->vdisk);
1358+
}
1359+
fixup_write_zeroes(device, q);
1360+
fixup_discard_support(device, q);
13731361
}
13741362

13751363
/* Starts the worker thread */

0 commit comments

Comments
 (0)