Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2397a15a authored by Bart Van Assche's avatar Bart Van Assche Committed by Mike Snitzer
Browse files

dm rq: factor out dm_mq_stop_queue()



Also, check that the blk-mq request_queue isn't already stopped.

Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 3b785fbc
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -98,18 +98,30 @@ static void dm_old_stop_queue(struct request_queue *q)
	spin_unlock_irqrestore(q->queue_lock, flags);
}

void dm_stop_queue(struct request_queue *q)
static void dm_mq_stop_queue(struct request_queue *q)
{
	if (!q->mq_ops)
		dm_old_stop_queue(q);
	else {
		spin_lock_irq(q->queue_lock);
	unsigned long flags;

	spin_lock_irqsave(q->queue_lock, flags);
	if (blk_queue_stopped(q)) {
		spin_unlock_irqrestore(q->queue_lock, flags);
		return;
	}

	queue_flag_set(QUEUE_FLAG_STOPPED, q);
		spin_unlock_irq(q->queue_lock);
	spin_unlock_irqrestore(q->queue_lock, flags);

	/* Avoid that requeuing could restart the queue. */
	blk_mq_cancel_requeue_work(q);
	blk_mq_stop_hw_queues(q);
}

void dm_stop_queue(struct request_queue *q)
{
	if (!q->mq_ops)
		dm_old_stop_queue(q);
	else
		dm_mq_stop_queue(q);
}

static struct dm_rq_target_io *alloc_old_rq_tio(struct mapped_device *md,