From: Philipp Reisner <philipp.reisner@linbit.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Philipp Reisner <philipp.reisner@linbit.com>,
linux-block@vger.kernel.org,
Lars Ellenberg <lars.ellenberg@linbit.com>,
Christoph Hellwig <hch@lst.de>,
drbd-dev@lists.linbit.com
Subject: [PATCH 4/7] drbd: merge drbd_setup_queue_param into drbd_reconsider_queue_parameters
Date: Wed, 6 Mar 2024 15:03:29 +0100 [thread overview]
Message-ID: <20240306140332.623759-5-philipp.reisner@linbit.com> (raw)
In-Reply-To: <20240305134041.137006-1-hch@lst.de>
From: Christoph Hellwig <hch@lst.de>
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 <hch@lst.de>
Reviewed-by: Philipp Reisner <philipp.reisner@linbit.com>
Reviewed-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Tested-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
---
drivers/block/drbd/drbd_nl.c | 56 ++++++++++++++----------------------
1 file changed, 22 insertions(+), 34 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 0326b7322ceb..0f40fdee0899 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1309,45 +1309,16 @@ static unsigned int drbd_backing_dev_max_segments(struct drbd_device *device)
return max_segments;
}
-static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backing_dev *bdev,
- unsigned int max_bio_size, struct o_qlim *o)
-{
- struct request_queue * const q = device->rq_queue;
- unsigned int max_hw_sectors = max_bio_size >> 9;
- unsigned int max_segments = BLK_MAX_SEGMENTS;
- struct request_queue *b = NULL;
-
- if (bdev) {
- b = bdev->backing_bdev->bd_disk->queue;
-
- max_hw_sectors = min(queue_max_hw_sectors(b), max_bio_size >> 9);
- max_segments = drbd_backing_dev_max_segments(device);
-
- blk_set_stacking_limits(&q->limits);
- }
-
- blk_queue_max_hw_sectors(q, max_hw_sectors);
- blk_queue_max_segments(q, max_segments);
- blk_queue_segment_boundary(q, PAGE_SIZE-1);
- decide_on_discard_support(device, bdev);
-
- if (b) {
- blk_stack_limits(&q->limits, &b->limits, 0);
- disk_update_readahead(device->vdisk);
- }
- fixup_write_zeroes(device, q);
- fixup_discard_support(device, q);
-}
-
void drbd_reconsider_queue_parameters(struct drbd_device *device,
struct drbd_backing_dev *bdev, struct o_qlim *o)
{
- unsigned int now = queue_max_hw_sectors(device->rq_queue) <<
- SECTOR_SHIFT;
+ struct request_queue * const q = device->rq_queue;
+ unsigned int now = queue_max_hw_sectors(q) << 9;
+ struct request_queue *b = NULL;
unsigned int new;
if (bdev) {
- struct request_queue *b = bdev->backing_bdev->bd_disk->queue;
+ b = bdev->backing_bdev->bd_disk->queue;
device->local_max_bio_size =
queue_max_hw_sectors(b) << SECTOR_SHIFT;
@@ -1369,7 +1340,24 @@ void drbd_reconsider_queue_parameters(struct drbd_device *device,
drbd_info(device, "max BIO size = %u\n", new);
}
- drbd_setup_queue_param(device, bdev, new, o);
+ if (bdev) {
+ blk_set_stacking_limits(&q->limits);
+ blk_queue_max_segments(q,
+ drbd_backing_dev_max_segments(device));
+ } else {
+ blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
+ }
+
+ blk_queue_max_hw_sectors(q, new >> SECTOR_SHIFT);
+ blk_queue_segment_boundary(q, PAGE_SIZE - 1);
+ decide_on_discard_support(device, bdev);
+
+ if (bdev) {
+ blk_stack_limits(&q->limits, &b->limits, 0);
+ disk_update_readahead(device->vdisk);
+ }
+ fixup_write_zeroes(device, q);
+ fixup_discard_support(device, q);
}
/* Starts the worker thread */
--
2.40.1
next prev parent reply other threads:[~2024-03-06 14:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 13:40 drbd atomic queue limits conversion Christoph Hellwig
2024-03-05 13:40 ` [PATCH 1/7] drbd: pass the max_hw_sectors limit to blk_alloc_disk Christoph Hellwig
2024-03-05 13:40 ` [PATCH 2/7] drbd: refactor drbd_reconsider_queue_parameters Christoph Hellwig
2024-03-05 13:40 ` [PATCH 3/7] drbd: refactor the backing dev max_segments calculation Christoph Hellwig
2024-03-05 13:40 ` [PATCH 4/7] drbd: merge drbd_setup_queue_param into drbd_reconsider_queue_parameters Christoph Hellwig
2024-03-05 13:40 ` [PATCH 5/7] drbd: don't set max_write_zeroes_sectors in decide_on_discard_support Christoph Hellwig
2024-03-05 13:40 ` [PATCH 6/7] drbd: split out a drbd_discard_supported helper Christoph Hellwig
2024-03-05 13:40 ` [PATCH 7/7] drbd: atomically update queue limits in drbd_reconsider_queue_parameters Christoph Hellwig
2024-03-06 14:03 ` [PATCH 0/7] drbd atomic queue limits conversion Philipp Reisner
2024-03-06 15:35 ` Jens Axboe
2024-03-06 14:03 ` [PATCH 1/7] drbd: pass the max_hw_sectors limit to blk_alloc_disk Philipp Reisner
2024-03-06 14:03 ` [PATCH 2/7] drbd: refactor drbd_reconsider_queue_parameters Philipp Reisner
2024-03-06 14:03 ` [PATCH 3/7] drbd: refactor the backing dev max_segments calculation Philipp Reisner
2024-03-06 14:03 ` Philipp Reisner [this message]
2024-03-06 14:03 ` [PATCH 5/7] drbd: don't set max_write_zeroes_sectors in decide_on_discard_support Philipp Reisner
2024-03-06 14:03 ` [PATCH 6/7] drbd: split out a drbd_discard_supported helper Philipp Reisner
2024-03-06 14:03 ` [PATCH 7/7] drbd: atomically update queue limits in drbd_reconsider_queue_parameters Philipp Reisner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240306140332.623759-5-philipp.reisner@linbit.com \
--to=philipp.reisner@linbit.com \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linbit.com \
--cc=hch@lst.de \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox