[Devel] [PATCH RH7 1/6] ploop: Move blk_queue_make_request() into __ploop_dev_alloc()

Kirill Tkhai ktkhai at virtuozzo.com
Thu Sep 3 17:10:18 MSK 2020


We have no more make_request functions except ploop_make_request(),
so it looks sane to place its assignment into device creation
function.

The only thing we extract from blk_queue_make_request() is
queue defaults assignment. It will be called before every
->queue_settings().

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index d999bffd3681..07226e7631f4 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4206,7 +4206,6 @@ static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 	/* Deltas are ready. Enable block device. */
 	set_device_ro(bdev, (top_delta->flags & PLOOP_FMT_RDONLY) != 0);
 
-	blk_queue_make_request(q, ploop_make_request);
 	q->queuedata = plo;
 	q->backing_dev_info.congested_fn = ploop_congested;
 	q->backing_dev_info.congested_fn2 = ploop_congested2;
@@ -4217,6 +4216,7 @@ static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 	blk_queue_flush(q, REQ_FLUSH);
 
 	plo->force_split_discard_reqs = false;
+	blk_set_default_limits(&q->limits);
 	top_delta->io.ops->queue_settings(&top_delta->io, q);
 	/* REQ_WRITE_SAME is not supported */
 	blk_queue_max_write_same_sectors(q, 0);
@@ -5617,6 +5617,8 @@ static struct ploop_device *__ploop_dev_alloc(int index)
 	if (!plo->disk)
 		goto out_queue;
 
+	blk_queue_make_request(plo->queue, ploop_make_request);
+
 	spin_lock_init(&plo->lock);
 	spin_lock_init(&plo->dummy_lock);
 	plo->queue->queue_lock = &plo->dummy_lock;




More information about the Devel mailing list